12-11-2014 03:43 AM
I run a sas program and want to save the final table in sas format. So I can use the sas file directly in the future. How to save this table in sas format?
If I cannot save it in sas format, I can export this table into a CSV file. But I encounter a problem in the CSV file. For example,
SAS Fomat CSV
Then I import the CSV file into sas and cannot the result in the original SAS format. How to solve this problem? Thanks
12-11-2014 05:48 AM
If your final table is a SAS dataset you could create a permanent SAS-library (in case you are using the Enterprise Guide, there is an export button).
If your final table is the output of a procedure you could use the Output Delivery System-Output to get the procedure result and store it (in a library).
12-11-2014 08:42 AM
I use sas 9.3 Not the Enterprise version. How to export the SAS dataset by creating a permanent SAS-library?
The enterprise version only displays the first 50 tables but the final table is beyond 50th.
12-11-2014 08:54 AM
You can use either in Enterprise Guide: Click on your data file > Enterprise menu: "File" > "Export" > "Export <Filename>" > choose a directory and make sure that the "Files of type" is "Sas data file ..".
Or use code. This example "copies" the work file "A" to a folder:
* this is a work-file (non-permanent);
Do i=1 To 10 ; Output; End;
Libname MyLib "C:\Users\USERNAME\Desktop\SAS folder"; * check the path and make sure the folder exists - create manually :smileyalert: if necessary;
Data Have; * "copy" the work file to the library;
.. hope it helps :-)
12-11-2014 10:16 AM
12-11-2014 10:18 AM
Look for the step that produces your final dataset in the code and then alter the data .....; statement or the out= (if it is some other procedure) so that the dataset is created in a permanent library instead of work.
12-11-2014 11:50 AM
And just related to the appearance: Be very careful opening CSV files in Excel (and likely some other spreadsheets) as it tries to be "helpful" and treats what you thought was a character 0008899 as a numeric. If you save the file from Excel will change the actual value.