BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
yael
Quartz | Level 8

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

 

sas3.png

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

View solution in original post

5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Kurt_Bremser
Super User

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.

ballardw
Super User

@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.

yael
Quartz | Level 8

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

 

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1714 views
  • 4 likes
  • 4 in conversation