Hello
After receiving feedback here I found that the only way I can import excel file to SAS is by FILE-IMPOER DATA
Now I am asking about export to excel. When I open the FILE - EXPORT DATA I get the following window (attached).
Is there any way to save the output of RESULTS in Library WORK or SASUSER, because I tried with no success
Thanks for any help
Yes, you just need to know the network path to those libnames. If you right click on Work in explorer, you will see the network area, copy paste that in and it will save it there - they are only directories somewhere. However, why would you want to? It doesn't make sense, Work is a temporary work area which gets removed at the end of the session. Sasuser is another SAS created folder - not for your use. Create a proper directory somewhere and save your files to there.
Yes, you just need to know the network path to those libnames. If you right click on Work in explorer, you will see the network area, copy paste that in and it will save it there - they are only directories somewhere. However, why would you want to? It doesn't make sense, Work is a temporary work area which gets removed at the end of the session. Sasuser is another SAS created folder - not for your use. Create a proper directory somewhere and save your files to there.
A LIBRARY is a place for SAS tables, views and catalogs. Excel files do not belong there. Store them somewhere else.
Putting them into the same place where a library exists only creates confusion.
@yael wrote:
Now I am asking about export to excel. When I open the FILE - EXPORT DATA I get the following window (attached).
Is there any way to save the output of RESULTS in Library WORK or SASUSER, because I tried with no success
RESULTS do not go into any library.
To send things that end up in Results you would provide an ODS Destination for the procedures, the specific destination may depend on your needs. I typically use tagsets.Excelxp that creates XML readable by Excel for any non-graphic output.
Example:
ods tagsets.excelxp file="c:\path\example.xlsx"; /* though I normally save as xml name*/
proc print data=sashelp.class;
run;
ods tagsets.excelxp close;
put your preferred path to the folder you want in place of C:\path.
If your results are being generated as HTML you could use the File-Save as from the Results window to save as HTML and open with Excel.
You may have access to ODS EXCEL which would work similar to the tagsets.excelxp example.
Hello @ballardw
Following your answer I tried the following code:
ods excel file='C:\Users\Hedvay\Documents\excel1.xlsx';
proc means data=sasuser.sasfile170716 mean median std min max;
var ROA;
class FIRMDEFI;
run;
ods excel close;
The answer I got in LOG window is:
ods excel file='C:\Users\Hedvay\Documents\excel1.xlsx';
-----
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
2 proc means data=sasuser.sasfile170716 mean median std min max;
3 var ROA;
4 class FIRMDEFI;
5 run;
NOTE: Writing HTML Body file: sashtml.htm
NOTE: There were 4814 observations read from the data set SASUSER.SASFILE170716.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.92 seconds
cpu time 0.79 seconds
6 ods excel close;
-----
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
That means that I can't use it in SAS?
Thanks for any feedback
ods excel is a SAS v9.4 feature, if your not running that version, you won't have it. If you are running that, then check the statements before the ods for errors, unfinished quotes or macros etc. which could be causing further issues.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.