LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2011, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 8 Jun 2011 11:55:11 -0400
Reply-To:   Bolotin Yevgeniy <ybolotin@SCHOOLS.NYC.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Bolotin Yevgeniy <ybolotin@SCHOOLS.NYC.GOV>
Subject:   Re: Chance to Make SAS-L History: Did You Know That...

If taking this approach, you can save yourself a few keystrokes (at least on Windows) by remembering that the OS knows how to handle files.

all of these will work as expected, and launch the default program for handling the appropriate filetype or handle:

start http://www.google.com start c:\myfile.xls start c:\myfile.rtf

(you need to include http:// or whatever's appropriate for webpages so it knows you're not trying to open a file)

On Wed, 8 Jun 2011 14:02:23 +0000, Michael Raithel <michaelraithel@WESTAT.COM> 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 >+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Back to: Top of message | Previous page | Main SAS-L page