Automatically open an Excel file using proc export

Reply
Frequent Contributor
Posts: 76

Automatically open an Excel file using proc export

 

How can I make the excel file automatically open (in excel) once it's created (rather than navigate to the folder and manually open it)?

 

This is what i have:

 

proc export data=name

dbms=xlsx

outfile='path\name.xlsx'

replace;

run;

 

 

Super User
Posts: 11,343

Re: Automatically open an Excel file using proc export

Posted in reply to fieldsa83

Proc export does not provide a trigger to open data sets since it is intended for data interchange.

 

Procedures that generate tabular output such as reports and such use the "View results as they are generated" setting in the Preferences tab under Tools>Options>Preferences menu.

 

If you want to read the results you might look towards an ODS output option with something like Proc Print.

 

Frequent Contributor
Posts: 76

Re: Automatically open an Excel file using proc export

If I use ODS with proc print the resulting excel file is 50mb. But with export it's 3mb. Do you know why this might be the case? 

 

I would be open to using ODS if I could get it to be a reasonable file size, especially since I can maintain the format of my variables.

Super User
Posts: 11,343

Re: Automatically open an Excel file using proc export

Posted in reply to fieldsa83

The size difference is because in simple data form EXCEL is actually Zipping (compressing) XML text. Try using ODS CSV to create a minimally formatted file that will open in Excel.

 

 

Super User
Posts: 19,851

Re: Automatically open an Excel file using proc export

Posted in reply to fieldsa83

If you have SAS 9.4 you can try ODS EXCEL

Frequent Contributor
Posts: 76

Re: Automatically open an Excel file using proc export

Is there a way to ONLY output it to excel (don't want it to show up in the
'results' tab of SAS)?

##- Please type your reply above this line. Simple formatting, no
attachments. -##
Super User
Posts: 19,851

Re: Automatically open an Excel file using proc export

Posted in reply to fieldsa83

I'm not sure what you mean...are you talking about getting HTML and Excel results?

If so turn off ods html.

 

 

ODS HTML OFF;

ODS EXCEL ....;

 

code

 

 

ODS EXCEL CLOSE;

ODS HTML;

Ask a Question
Discussion stats
  • 6 replies
  • 316 views
  • 0 likes
  • 3 in conversation