File Name: p71.pdf
File Size: 19.26 KB
File Type: Application/pdf
Last Modified: 23 years
Status: Available
Last checked: 2 days ago!
This Document Has Been Certified by a Professional
100% customizable
Language: English
We recommend downloading this file onto your computer
Coders' Corner It’s Only Temporary Janet Stuelpner, ASG, Inc., Cary, North Carolina Boris Krol, Pfizer, Inc., New York, New YorkABSTRACT METHODOLOGYVery often during an interactive SAS® session, it is In previous versions of the SAS system, it was notnecessary to create temporary external files. From possible to define both SAS data sets and ASCIIrelease 6.11 of the SAS System we have the ability files in the same directory. Now there is an easyto create a flat file within the same directory that way to do it
contains SAS data sets. There are benefits to usingthis new technique. This paper will show you how to FILENAME fileref CATALOG ‘catalog’;define this file in the WORK directory and thebenefits of its use. Above is a very general FILENAME statement. The words in upper case are required to remain theINTRODUCTION same. The fileref can be any valid file reference
The ‘catalog’ must be in the form:It is easy to create a permanent file using aLIBNAME statement for SAS data sets or a library.catalog.entry.entrytypeFILENAME statement for external files. However,each operating system has its own mechanism for where library must be WORK and entrytype must becreating a file that is temporary in nature. By SOURCE. If this structure is adhered to, thedefinition, a temporary file, whether it is a SAS data temporary file will be created in the WORKset or an external file, is one that is deleted at the directory. The most common temporary library isend of the SAS session. In the MVS operating the WORK library. The WORK data library is asystem, this is true. When a file is defined with an temporary SAS data library that is automaticallyampersand as its first character (e.g., &MYTEMP) it defined by the SAS system upon invocation to storeis deleted at the end of a batch job or an interactive temporary files. As we all know, this data library isSAS session. For example, temporary files can be deleted at the end of a session during the filedefined as follows: cleanup phase
LIBNAME SASTEMP ‘&TEMP’; EXAMPLES OF USE -or- FILENAME FLATEMP ‘&TEMP’; There are many reasons to create a temporary file
The two examples below show the most commonUnfortunately, the personal computer (PC) operating reasons to do this
systems do not react in the same manner. If a file isdefined, as in the example above, the file would Example 1reside on the hard drive in the current directory. Inthe PC environment, space and memory are Quite often it is necessary to write the output from aimportant, limited resources. Therefore, removal of procedure to an external file, read it back in to dounneeded files becomes extremely urgent. To some processing before it is ultimately written to theremove these files would require manual output window or directly to the printer. One suchintervention. You can use an X statement to issue challenge is to count the number of pages that arean operating system command from within your produced in a report so that the total number ofSAS session (e.g., DELETE or ERASE). You can pages are included on each page. For example, ifalso use the X statement to invoke an application in the report has 10 pages, it is desirable for eachwhich you can delete a file (e.g., windows explorer page to specify 1 of 10, 2 of 10, 3 of 10, etc. Inor file manager). Another choice is to delete the order to accomplish this task, first the output mustfiles after exiting your SAS session. With the be directed to a temporary file. Then it is read into arelease of version SAS 6.11, there is a way to DATA step where the pages are counted and thencreate a temporary file that is automatically deleted the total number of pages is placed into a macrowhen the interactive session is over. variable. To achieve this, the output is sent to the external file by way of a PROC PRINTTO. The 1 Coders' Cornerfollowing code is a template of what needs to be SAS® is a registered trademark of the SAS Institute,done for the scenario that has been defined. Inc., in the USA and in other countries. indicates USA registration
filename tmp catalog ‘work.temp.outlist.source’; REFERENCESproc printto print=tmp new;run; SAS Institute Inc. (1995), SAS Software:proc report data=work.pgdata; Changes and Enhancements, Release 6.11, Cary, . NC: SAS Institute
more SAS code SAS Institute Inc. (1990), SAS Companion for the
MVS Environment, Version 6, Second Edition, Cary,
NC: SAS Instituterun;proc printto;run; SAS Institute Inc. (1993), SAS Companion for thedata _null_; Microsoft Windows Environment, Version 6, First . Edition, Cary, NC: SAS Institute
more SAS code Stuelpner, J. and Kaptsanov, E (1997), “All The . Data That’s Fit, We Print”, Proceedings of the . Twenty-second Annual SAS Users Grouprun; International Conference, 22, 474-476Example 2 Haworth, L (1997), “Reports Based on SAS Output: Taking Advantage of PROC PRINTTO,In the previous example, the entire output from a DATA Steps and PROC GPRINT”, Proceedings ofprocedure was placed in an external file. In this the Twenty-second Annual SAS Users Groupexample, a DATA _NULL_ is used to manipulate International Conference, 22, 233-241data being read in from another SAS data set
Within this DATA step, a PUT statement is used to Author Contactwrite out to an external file. Then the data is readback in and processed. Janet Stuelpner ASG, Inc.,filename tmp catalog ‘work.temp.outlist.source’; 326 Old Norwalk Road New Canaan, CT 06840data _null_; set work.mydata; (203) 966-7520 (voice) file tmp; (203) 966-8027 (fax) . [email protected]
put ‘%prt(‘memname $8,’)’; Boris Krol . Pfizer Inc
nd . 235 East 42 Streetrun; Mail Stop 150/37/30%include tmp; New York, NY 10017-5755 (212) 573-3003 (voice)CONCLUSION (212) 309-4346 (fax) [email protected]The new options on the FILENAME statement giveus great flexibility when working with external files
As shown above, the SAS System allows us tocreate an external file in the same WORK directorywith SAS data sets. This makes the external file astemporary as temporary SAS data sets. This is agreat benefit, especially if you are constrained byspace
The report has 10 pages, it is desirable for each page to specify 1 of 10, 2 of 10, 3 of 10, etc. In order to accomplish this task, first the output must be directed to a temporary file. Then it is …
It's Only Temporary is a fevered tour of a world on fire. Throw your bookmark away; you will not be able to put this story down... More Details... To see what your friends thought of this book, please sign up.
“It’s Only Temporary” uses the premise of the world about to end to provide the emotional stakes, rationale for a sense of horror, and plot tension to create an interesting tale of a journey to recover lost love.
It's Only Temporary is a heartfelt book for all of us who are getting younger and older at the same time. In a series of wonderful essays, Evan Handler gives himself up to us - warts and all. To our amusement and bemusement we share in his emotional growth as he struggles to mature.