|
For a slightly different approach, see
http://www.sascommunity.org/wiki/Tips:Automatically_opening_Excel_workbooks_created_by_the_ExcelXP_tagset
On Jun 8, 2011, at 7:02 AM, Michael Raithel wrote:
> Dear SAS-L-ers,
>
> Did you know that...
>
> ...you can open other Windows programs from within a SAS program?
>
> You might decide that it would be convenient to open Word, Excel, Windows Explorer, Internet Explorer, or possibly PowerPoint at some time during the execution of a SAS program. If so, it can be done programmatically using the SYSTEM function.
>
> In this example, we create a CSV file and then open Excel to QC the contents of that file:
>
> ods csv close;
>
> ods csv file="c:\temp\classlist.csv";
> run;
>
> proc print data=sashelp.class;;
> run;
>
> ods rtf close;
>
> data _null_;
>
> rc=system("start excel c:\temp\classlist.csv");
>
> run;
>
> You can see from the code that we are using the Output Delivery System to create a CSV file named classlist.csv. The DATA _NULL_ step uses the SYSTEM command to start Excel and open classlist.csv.
>
> Here is an example of creating an RTF file and then launching Word to open that file:
>
> options nodate nonumber;
>
> ods rtf close;
>
> ods rtf file="c:\temp\classlist.rtf";
> run;
>
> proc print data=sashelp.class;
> title1 "Mrs. Dob's 7th Grade Class Roster";
> run;
>
> ods rtf close;
>
>
> data _null_;
>
> rc=system("start winword c:\temp\classlist.rtf");
>
> run;
>
> Pretty neat, eh? Don't take my word for it; cut-n-paste these examples into a SAS Display Manager session and take them for a test drive.
>
> You can also use the SYSTEM command in open code via SAS Macro code as in this example that launches my favorite web site:
>
> %let rc=%sysfunc(system(start iexplore www.westat.com)<http://www.westat.com)>);
>
> I would bet that you can find dozens of uses for opening Windows programs with the SYSTEM function in your own SAS programs!
>
> Best of luck in all of your SAS endeavors!
>
>
> I hope that this suggestion proves helpful now, and in the future!
>
> Of course, all of these opinions and insights are my own, and do not reflect those of my organization or my associates. All SAS code and/or methodologies specified in this posting are for illustrative purposes only and no warranty is stated or implied as to their accuracy or applicability. People deciding to use information in this posting do so at their own risk.
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Michael A. Raithel
> "The man who wrote the book on performance"
> E-mail: MichaelRaithel@westat.com
>
> Author: Tuning SAS Applications in the MVS Environment
>
> Author: Tuning SAS Applications in the OS/390 and z/OS Environments, Second Edition
>
> http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=58172
>
> Author: The Complete Guide to SAS Indexes
>
> http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=60409
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> A perfect summer day is when the sun is shining, the breeze is blowing, the birds
> are singing, and the lawnmower is broken. - James Dent
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|