Importing Prophet Projection file into SAS - sas

Our customer has provided us with a Prophet ".projection" file, which appears to be a binary file (lots of special characters when opening in notepad - ?Š…kÿd?Š…kÿd? ).
My question is - how can this file be imported into SAS? The file was generated from Prophet version 8.1 (PE). In Prophet 7.3 it was possible to use Readbin73 to do the binary->text conversion of the PRJs etc. Is there anything similar for 8.1?

Open the Prophet Workspace (.PRW) file to which your .projection file relates.
Click on Results & Runlogs in the sidebar and expand the option that says "ResultType: Projection".
In the upper left corner of the ribbon you will see two options:
"Copy Grid" allows you to copy the data to the clipboard, after
which you can paste the tab separated data in the programme of your
choice.
"Copy Grid to Excel" allows you to export the data
directly to Excel.
You can then prepare the data for SAS.
These steps work in Prophet 8.2.

Related

Power BI - Finding the data source

How can I find the data source of my report? I recently changed laptops and moved my report to the new laptop, but I forgot the data source for my report. I used my database as a data source but because I am not sure on the path of the data source I can not refresh my dataset. Please help.
Other than the method mentioned by #mkRabbani using the Advanced editor, the simplest way is to
click on the "Gear" icon beside the Source Step
and it will open a pop-up using which you can identify the existing source and also replace the source to a different one.
Please note that this applies to all data source, not just excel (but with their own customizations)
If you are looking for the folder location of your data files, go to Power Query Editor and right click on the table you wants to know the source. Then click the Advance editor option and you will get the source as shown below-

Is there a Windows alternative to Mainframe FileAID?

For work, I'm on a team that is migrating a system from Mainframe to AWS. Part of the work I do is using FileAID to work on fixed-width files with custom layouts (here, if anyone is curious) What I'm wondering is, is there any sort of a desktop application that has similar file layout display features similar to FileAID?
Two Optioms
Microfocus Cobol has an editor
RecordEditor can display fixed width file.
RecordEditor
The RecordEditor can display Binary Mainframe or PC / Linux text files.
For File Description the RecordEditor can:
Use File Descriptions entered into it
Imported Cobol Copybooks
Cobol Copybooks directly (Single Record File types)
Xml File Descriptions
Entering filename and Cobol Copybook:
File Display:
Record Display:
Note: When first starting the RecordEditor make sure you select the schema and also the Cobol option
Related question
Binary Mainframe Cobol Files
RecordEditor Layout Wizard
CudaText editor (free, cross platform) has rich lexer engine, so it's easy to write a "lexer" which supports such formats.
For example, "Intel HEX" is a file format with fixed columns, and lexer "Intel HEX" is present in CudaText addons. It looks like this:
This lexer even highlights "wrong lines" with red.

How to open a tab-delimited file in Weka

When I try to open a tab-delimited file in Weka it says: "file format is not recognized". In the subsequent dialog box it shows weka.core.converters.CSVLoader and says "Reads a source that is in comma separated or tab separate format." When I click the OK button, it throws an error saying "wrong number of values. Read 11, expected 10 line 4." I verified the same file in Excel that the line had 10 fields.
Could someone advise a workaround?
The data file cannot be converted to CSV format because some of the fields contain a comma.
When installing the unofficial Weka package common-csv-weka-package, you can load tab-delimited CSV files using the CommonCSVLoader loader. Simply change the loader's format from DEFAULT to TDF (-F command-line option).
I had same problem. So far the best solution I found is using R to convert a tabular data file into arff. Google two keywords "import data to R" and "export R data to weka arff". My second choice is using JMP or SAS to open a csv or Excel workbook and then export as CSV.
I found a solution: for Windows 10, install the R language package from this url:
https://cran.r-project.org/web/packages/rio/index.html
install RStudio from:
https://www.rstudio.com/products/rstudio/download/#download
from the prompt in RStudio follow the Import, Export, and Convert Data Files instructions here:
https://cran.microsoft.com/snapshot/2015-11-15/web/packages/rio/vignettes/rio.html
works a treat, converted my .tsv files to Weka arff format no problem. The only thing I haven't done is test the arff files in Weka yet (and compare with Python sklearn results), as I'm hoping there isn't a problem with commas embedded in the text message bodies. Scikit-Learn and TfidfVectorizer has no problems with embedded commas in a tsv file!

Comparing the contents of two files in Sublime Text

I have two cloned repositories of two very similar open-source projects, which I have been working on in different instances in Sublime Text 2 to arrive at my desired result. Code from both of these projects was used. I have been using Git as version control for my project, but have not included the original projects. Thus, I would like to be able to quickly compare the contents of two files of the original project and compare the differences between them and my project.
I was hoping that Sublime Text 2 would have a "Compare File" feature, but I can't seem to find anything related to it in the settings or online. A third-party ST2 package to accomplish this task would also work well. Is such a task possible to do within the ST2 text editor?
You can actually compare files natively right in Sublime Text.
Navigate to the folder containing them through Open Folder... or
in a project
Select the two files (ie, by holding Ctrl on
Windows or ⌘ on macOS) you want to compare in the sidebar
Right click and select the Diff files... option.
Compare Side-By-Side looks like the most convenient to me though it's not the most popular:
UPD: I need to add that this plugin can freeze ST while comparing big files. It is certainly not the best decision if you are going to compare large texts.
There are a number of diff plugins available via Package Control. I've used Sublimerge Pro, which worked well enough, but it's a commercial product (with an unlimited trial period) and closed-source, so you can't tweak it if you want to change something, or just look at its internals. FileDiffs is quite popular, judging by the number of installs, so you might want to try that one out.
UPDATE (Given the upvotes, I feel there is a need for a complete step-by-step explanation...)
In the Menu bar click on File->Open Folder...
Select a folder (the actual folder does not really matter, this step is just to make the FOLDERS sidebar available)
If there is no Side Bar shown yet, make it appear via View -> Side Bar -> Show Side Bar
Use this FOLDERS-titled Side Bar to navigate to the first file you want to compare.
Select it (click on it), hold down ctrl and select the second file.
Having two files selected, right click on one of the two and select Diff Files...
There should be a new Tab now showing the comparison.
Original short answer:
Note that:
The "Diff files" only appears with the "folders" sidebar (to open a folder: File->Open Folder) , not with "open files" sidebar.
UPDATE JAN 2018 - especially for Sublime/Mac
(This is very similar to Marty F's reply, but addresses some issues from previous responses, combines several different suggestions and discusses the critical distinction that gave me problems at first.)
I'm using Sublime Text 3 (build 3143) on Mac and have been trying for about 30 minutes to find this File Compare feature. I had used it before on Sublime/Mac without any problems, but this time, it was trickier. But, I finally figured it out.
The file format does not need to be UTF-8. I have successfully compared files that are UTF-8, ISO-8559-1, and Windows-1252.
There is no File > Open Folders on Sublime/Mac. Many instructions above start with "Select File > Open Folders," but that doesn't exist on Sublime/Mac.
File compare works on a Project basis. If you want to compare two files, they must be saved to disk and part of the current project.
Ways to open a project
If Sublime/Mac is not running or if it's running but no windows are open, drag a folder onto the Sublime app.
If Sublime/Mac is running, select "File > Open", navigate to the desired folder, don't select a file or folder and click "Open".
Add a folder to a project. If the files you want to compare are not part of the same hierarchy, first open the folder containing one of the files. Then, select "Project > Add Folder to Project", navigate to the folder you want and click "Open". You will now see two root-level folders in your sidebar.
The Sidebar must be visible. You can either "View > Side Bar > Show Side Bar" or use the shortcut, Command-K, Command-B.
Files must be closed (ie, saved) to compare. Single-clicking a file in the Side Bar does not open the file, but it does display it. You can tell if a file is open if it's listed in the "Open Files" section at the top of the Side Bar. Double-clicking a file or making a modification to a file will automatically change a file's status to "Open". In this case, be sure to close it before trying to compare.
Select files from the folder hierarchy. Standard Mac shorcut here, (single) click the first file, then Command-click the second file. When you select the first file, you'll see its contents, but it's not open. Then, when you Command-click the second file, you'll see its contents, but again, neither are open. You'll notice only one tab in the editing panel.
Control-click is not the same as right-click. This was the one that got me. I use my trackpad and often resort to Control-click as a right-click or secondary-click. This does not work for me. However, since I configured my trackpad in System Preferences to use the bottom-right corner of my trackpad as a right-click, that worked, displaying the contextual menu, with "Delete", "Reveal in Finder", and.... "Diff Files..."
Voilà!
UPDATE OCTOBER 2017
I never knew this feature existed in Sublime Text, but the interface appears to have changed slightly from the previous answer - at least on OS X. Here are the detailed steps I followed:
In the Menu Bar click File -> Open...
Navigate to the FOLDER that contains the files to be compared and with the FOLDER selected, click the Open button, this makes the FOLDERS sidebar appear
In the FOLDERS sidebar, click on the first file to be compared
Hold the Ctrl on Windows or ⌘ on OS X, and click the second file
With both files selected, right click on one and select Diff Files...
This opens a new tab showing the comparison. The first file in red, the second in green.
View - Layout and View - Groups will do in latest Sublime 3
eg:
Shift+Alt+2 --> creates 2 columns
Ctrl+2 --> move selected file to column 2
This is for side by side comparison.
For actual diff, there is the diff function other already mentioned.
Unfortunately, I can't find a way to make columns scroll at the same time, which would be a nice feature.
The Diff Option only appears if the files are in a folder that is part of a Project.
Than you can actually compare files natively right in Sublime Text.
Navigate to the folder containing them through Open Folder... or in a project
Select the two files (ie, by holding Ctrl on Windows or ⌘ on macOS) you want to compare in the sidebar
Right click and select the Diff files... option.
No one is talking about Linux but all above answers will work. Just use Ctrl to select more than one file. If you are looking to compare side by side, Meld is lovely.
There's a BeyondCompare plugin as well. It opens the 2 files in a BeyondCompare window. Pretty convenient to open files from the sublime window.
You will need BC3 installation present in the system.
After installing the plugin, you will have to provide the path to the installation.
Example:
{
//Define a custom path to beyond compare
"beyond_compare_path": "G:/Softwares/Beyond Compare 3/BCompare.exe"
}

How can I read/convert SAS Gov't Data files on a MAC?

There are gov't data files: http://www.cdc.gov/EpiInfo/
Available in this weird SAS format. How can I convert them into XML/CSV, something much simpler that can be read by scripts/etc.???
I had the same problem, so i made a simple SAS data viewer. You download it from the downloads section here: http://code.google.com/p/sasquatch
It has alot of the same features as SAS Universal Viewer, but its still a work in progress.
You need to have Adobe AIR installed, you can get that on the adobe website.
Are the data in the SAS XPORT (.xpt) or .sas7bdat format?
For future reference, SAS XPORT files can be read and written using the 'SASxport' package for R (http://cran.r-project.org/web/packages/SASxport/index.html).
(Already posted this to superuser.com)
SAS Institute (the company that makes SAS) produces a viewer for SAS data sets.
Note that SAS program files usually have the extension .sas, whereas the data files themselves usually have the extension .sas7bdat.
(EDIT: I notice belatedly that your title says on a Mac, so this may not help much as I believe the tool is Windows only.)
Here a quick-and-dirty python five-liner to convert a SAS .xpt (aka XPORT) file to .csv
import pandas as pd
FILE_PATH = "(fully qualified name of directory containing file)"
FILE = "ABC" # filename itself (without suffix)
# Note: might need to substitute the column name of the index (in quotes) for "None" here
df = pd.read_sas(FILE_PATH + FILE + '.XPT', index=None)
df.to_csv(FILE_PATH + FILE + '.csv')
Hopefully this might help someone
JMP runs on MAC and can read sas files. Visit jmp.com for more information.
There are two parts to your question
1. Read these files
2. Convert these files
I looked into the link you shared there are no directly downloadable files, but I am assuming that you mean the files for windows.
For viewing you can use the folloiwng
a. SAS Universal viewer: https://support.sas.com/downloads/package.htm?pid=667
b. Use SAS on mac to directly read the files
For conversion you can do the following
a. Use SAS proc import to export and proc export to export the files feature,
b. Use third party softwares, e.g., DBMSCopy for this;
c. Download trial version of JMP and convert the files to desired format, e.g., CSV/txt etc and get done with it.