Review of PC-SAS Batch Programming

Size: px
Start display at page:

Download "Review of PC-SAS Batch Programming"

Transcription

1 Ronald J. Fehd September 21, 2007 Abstract This paper presents an overview of issues of usage of PC-SAS R in a project directory. Topics covered include directory structures, how to start SAS in a particular (project) directory, SAS command line invocation, location and modification of SAS configuration files, creation and usage of a project autoexec, and directing output in various formats, e.g.: html, rtf, or xls to appropriate directories. Example programs are executed with Windows batch files so that each program s log and list can be examined separately. Example projects are provided to illustrate intermediate and advanced program reuse, i.e., either of macros or include files where programs are stored not only in the project directory and also in a site (centralized, available to all projects) directory. This is not an introduction to SAS programming but it is about how to manage PC-SAS batch programming and output. Audience: Expected audience is all users of PC-SAS, especially anyone using SAS for more than one project. Keywords: autoexec batch configuration ODS PC-SAS Windows. Introduction When SAS is installed, the user will have at least a Windows Program item or, at best, a SAS icon on the desktop. Executing SAS using either of these methods yields an interactive session where Alt- File-Open defaults to a directory which Windows specifies and SAS adds yet another couple of subdirectories underneath. The purpose of this paper is to provide the necessary knowledge to change the File- Open and File- Save-As directory to a particular project directory, which can be either on the user s desktop or on a Local Area Network (LAN). 1

2 Contents 1 Project A: use one directory, make SASv?.cfg Task 1-a: Check File-Open Default Task 1-b: Create SASv?.cfg: Task 1-c: Check File-Open to ProjectA Task 2-a: Execute SAS programs PrgA1ProcFormat PrgA2ReadText: PrgA3ProcFreq: Task 2-b: View batch, program, log, list atask2-b: Q: How many file-types? Q: What do programs have in common? Task 9: clean-up Project B: use directories, make autoexec.sas Task 1-a: Check Library is not assigned Task 1-b: Create autoexec.sas Task 1-c: Check Library assigned by autoexec Task 2: Execute SAS programs btask2-a PrgB1ProcFormat PrgB2Autocall PrgB3Includes PrgB4Includes inobs iproccontents iprocprint iprocsqldescribetable isyslast2xls Task 2-b: View batch, program, log, list btask2-b Task 2-c: View Excel output btask2-c Q: what do programs have in common? Task 9: clean up End Notes Project C: create new SAS program Task 1-a: Review SASv9.cfg Task 1-b: Review autoexec.sas Task 2-a: Execute SAS programs ctask2-a ODShtml ODShtml2xls ODSrtf SASdata2xls Q: SASdata2xls: Where is macro SAS2xls? Task 2-b: Review programs and logs Task 2-c: Review output in other directories SASexe.bat Task 3-a: Create new SAS program NotePadBat.bat NotePadSAS.bat xsas.sas Task 3-b: Review programs and logs Task 9: clean up Options 31 pg. 2

3 1 Project A: use one directory, make SASv?.cfg Description 1. How to change Alt-File-Open to ProjectA (a) Start SAS, check File-Open default: SASuser (b) Create SASv?.cfg (c) Start SAS, check File-Open is ProjectA 2. How to execute SAS programs with batch files (a) Execute all or each program with batch file(s) (b) Review batch, program, log, and list Purpose 1. Show that option SASinitialFolder in SASv?.cfg is necessary to start SAS in a particular directory: ProjectA 2. Show how to run SAS programs in batch, save and review log and list Project A programs are in sub-directory../projecta/. The task list for Project A is in aareadmea.txt. This file can be opened with NotePad by double-clicking on aareadmea.bat. 1 rem aareadmea.bat 2 NotePad aareadmea.txt aareadmea.bat pg. 3

4 Contents 1.1 Task 1-a: Check File-Open Default Task 1-b: Create SASv?.cfg: Task 1-c: Check File-Open to ProjectA Task 2-a: Execute SAS programs PrgA1ProcFormat PrgA2ReadText: PrgA3ProcFreq: Task 2-b: View batch, program, log, list atask2-b: Q: How many file-types? Q: What do programs have in common? Task 9: clean-up pg. 4

5 1.1 Task 1-a: Check File-Open Default A SAS session can be started by double-clicking on SAS.bat. Note that this will run either of v8 or v9.1, whichever is installed (using the standard installation) on your desktop. If you have both, then v9 will start after you close v8. SAS.bat 1 rem name: SAS.bat 2 "C:\Program Files\SAS Institute\SAS\V8\sas" %* 3 "C:\Program Files\SAS\SAS 9.1\SAS" %* Q: Alt-File-Open to which directory? 19 Alt-File-Open to SASuser: 20?CSIDL_PERSONAL\My SAS Files\V NOTE: Libref= SASUSER 23 Scope= Kernel 24 Engine= V8 atask1-a8.log 25 Physical Name= C:\Documents and Settings\Administrator\My Documents\My SAS Files\V8 atask1-a9.log 20 Alt-File-Open to SASuser: 21 C:\Documents and Settings\Administrator\My Documents\My SAS Files\ NOTE: Libref= SASUSER 24 Scope= Kernel 25 Engine= V9 26 Physical Name= C:\Documents and Settings\Administrator\My Documents\My SAS Files\9.1 pg. 5

6 1.2 Task 1-b: Create SASv?.cfg: See atask1-b.bat which creates a configuration file for this project. This batch file copies the example file, and opens it; as you close each of the files, the next one will be opened. The process is designed to create the files; you are not expected to make any changes. atask1-b.bat 1 rem name: atask1-b.bat 2 rem description: copy xsasv?.cfg to SASv?.cfg 3 rem open each with NotePad 4 rem purpose: create SASv?.cfg 5 rem note: exit NotePad: Alt-File-eXit 6 7 rem +R set Read-Only 8 rem -R set Read-Write 9 rem /Y no prompt for overwrite attrib +R xsasv8.cfg 12 copy /Y xsasv8.cfg SASv8.cfg 13 attrib -R SASv8.cfg 14 NotePad SASv8.cfg attrib +R xsasv9.cfg 17 copy /Y xsasv9.cfg SASv9.cfg 18 attrib -R SASv9.cfg 19 NotePad SASv9.cfg SASv8.cfg 1 /* name: SASv8.cfg must call primary config: */ 2 -CONFIG "C:\Program Files\SAS Institute\SAS\V8\SASV8.CFG" 3 -SASinitialFolder C:\temp\setupPC-SAS\projectA 1 /* name: SASv9.cfg */ SASv9.cfg 2 -SASinitialFolder C:\temp\setupPC-SAS\projectA Note: case is irrelevant for options: sasinitialfolder will work. pg. 6

7 1.3 Task 1-c: Check File-Open to ProjectA Use SAS.bat to start SAS again. Task Q: Alt-File-Open to which directory? With Alt-File-Open you now see ProjectA. 17 Alt-File-Open to SASinitialFolder: 18 C:\temp\setupPC-SAS\projectA atask1-c9.log pg. 7

8 1.4 Task 2-a: Execute SAS programs PrgA1ProcFormat See the.bat and.sas. Each of the three SAS programs provided has a batch file provided to run it. You may also execute the program from the last SAS session which you started, after creating the SASv?.cfg so that the programs are available via Alt-File-Open. PrgA1ProcFormat.bat 1 rem name: PrgA1ProcFormat.bat 2 "C:\Program Files\SAS Institute\SAS\V8\sas" -sysin PrgA1ProcFormat 3 "C:\Program Files\SAS\SAS 9.1\SAS" -sysin PrgA1ProcFormat PrgA1ProcFormat.sas 1 /* name: PrgA1ProcFormat.sas; 2 description: example of proc Format 3 purpose: show save to Library 4 note: during project preparation 5 cut&paste value descriptions 6 from data dictionary 7 run once : */ 9 libname Library C:\temp\setupPC-SAS\projectA ; 10 title1 C:\temp\setupPC-SAS\projectA ; 11 options nocenter; PROC Format library = Library ; value $test a = 1 16 b = 2; value boolean 0 = false 19 1 = true 20 other = missing ; *print list of (in)formats; 23 PROC Format library = Library fmtlib ; 24 title2 library = Library fmtlib ; run; pg. 8

9 1.4.2 PrgA2ReadText: PrgA3ProcFreq: PrgA2ReadText.sas 1 /* name: PrgA2ReadText.sas; 2 description: Read Cards 3 purpose: demo write to Library 4 note: uses format created in PrgA1ProcFormat : */ 6 7 libname Library C:\temp\setupPC-SAS\projectA ; 8 title1 C:\temp\setupPC-SAS\projectA ; 9 options nocenter; DATA Library.PrgA2ReadText; 12 attrib Id length = 4 %*integer; 13 Var length = 4 format = boolean. ; 14 infile cards; 15 ID var 17 ;cards; ; 24 Proc Print data = Library.PrgA2ReadText ; 25 title2 data = Library.PrgA2ReadText ; 26 run; PrgA3ProcFreq.sas 1 /* name: PrgA3ProcFreq.sas; 2 description: summarization example 3 purpose: demo save and print of proc Freq output : */ 5 libname Library C:\temp\setupPC-SAS\projectA ; 6 title1 C:\temp\setupPC-SAS\projectA ; 7 options nocenter; 8 9 PROC Freq data = Library.PrgA2ReadText ; 10 title2 data = Library.PrgA2ReadText ; 11 tables Var 12 / list missing 13 out = Library.PrgA3ProcFreqVar ; PROC Print data = Library.PrgA3ProcFreqVar ; 16 title2 data = Library.PrgA3ProcFreqVar ; run; pg. 9

10 1.5 Task 2-b: View batch, program, log, list atask2-b: See the.bat and.sas. Each of the three SAS programs provided has a batch file provided to run it. This program is a viewer for the first batch file, each program, log and list. atask2-b.bat 1 rem name: atask2-b.bat 2 rem description: view bat, program, log and list 3 4 NotePad PrgA1ProcFormat.bat 5 NotePad PrgA1ProcFormat.sas 6 if exist PrgA1ProcFormat.log NotePad PrgA1ProcFormat.log 7 if exist PrgA1ProcFormat.lst NotePad PrgA1ProcFormat.lst 8 9 NotePad PrgA2ReadText.sas 10 if exist PrgA2ReadText.log NotePad PrgA2ReadText.log 11 if exist PrgA2ReadText.lst NotePad PrgA2ReadText.lst NotePad PrgA3ProcFreq.sas 14 if exist PrgA3ProcFreq.log NotePad PrgA3ProcFreq.log 15 if exist PrgA3ProcFreq.lst NotePad PrgA3ProcFreq.lst 16 pg. 10

11 1.6 Q: How many file-types? The result of running each of the batch files is the creation of a log and list for each program. In addition there are format catalogs and permanent data sets. aareadmea.txt 31 Proj Q: how many file-types in ProjectA directory? 32 A: *.bat *.sas 33 *.cfg *.sas7bcat formats 34 *.log *.sas7bdat data set 35 *.lst *.txt aareadmea.bat aareadmea.txt atask1-a.bat atask1-a8.log atask1-a9.log atask1-b.bat atask1-c.bat atask1-c8.log atask1-c9.log atask2-a.bat atask2-b.bat atask9.bat formats.sas7bcat Prg1MakeFormat.log Prg1MakeFormat.lst Prg1ProcFormat.bat Prg1ProcFormat.log Prg1ProcFormat.lst Prg1ProcFormat.sas Prg2ReadText.bat Prg2ReadText.log Prg2ReadText.lst Prg2ReadText.sas prg2readtext.sas7bdat Prg3ProcFreq.bat Prg3ProcFreq.log Prg3ProcFreq.lst Prg3ProcFreq.sas prg3procfreqvar.sas7bdat SAS.bat SASv8.cfg SASv9.cfg xsasv8.cfg xsasv9.cfg xtaska.bat YdmDlgOpen.sas pg. 11

12 1.7 Q: What do programs have in common? Each program has the same set of libname, title1 and options. In Project B we will examine the use of an autoexec.sas, which works similar to the configuration file: it executes common SAS statements at the beginning of every program. PrgA1ProcFormat.sas 9 libname Library C:\temp\setupPC-SAS\projectA ; 10 title1 C:\temp\setupPC-SAS\projectA ; 11 options nocenter; PrgA2ReadText.sas 7 libname Library C:\temp\setupPC-SAS\projectA ; 8 title1 C:\temp\setupPC-SAS\projectA ; 9 options nocenter; PrgA3ProcFreq.sas 5 libname Library C:\temp\setupPC-SAS\projectA ; 6 title1 C:\temp\setupPC-SAS\projectA ; 7 options nocenter; 1.8 Task 9: clean-up Use atask9.bat to return ProjectA to original state. atask9.bat 1 rem name: atask9.bat 2 rem description: clean up directory 3 rem purpose: leave clean for next exercise 4 5 rem delete specific files 6 if exist autoexec.sas del autoexec.sas 7 if exist SASv8.cfg del SASv8.cfg 8 if exist SASv9.cfg del SASv9.cfg 9 10 rem delete all of a kind files 11 del *.sas7b?at 12 del *.log 13 del *.lst 14 del *.bak pg. 12

13 2 Project B: use directories, make autoexec.sas Description 1. How to consolidate multiple directory references into an autoexec (a) Check library is allocated (b) Create autoexec.sas (c) Check library is allocated 2. How to execute SAS programs with batch files (a) Execute all or each program with batch file(s) (b) Review batch, program, log, list, and Excel spreadsheet Purpose 1. Show that autoexec contains statements used by all programs 2. Show how to run SAS programs in batch, save and review log and list Project B programs are in sub-directory../projectb/pgm/. The task list for Project B is in aareadmeb.txt. This file can be opened with NotePad by double-clicking on aareadmeb.bat. aareadmeb.bat 1 rem aareadmeb.bat 2 NotePad aareadmeb.txt pg. 13

14 2.1 Task 1-a: Check Library is not assigned Contents 2.1 Task 1-a: Check Library is not assigned Task 1-b: Create autoexec.sas Task 1-c: Check Library assigned by autoexec Task 2: Execute SAS programs btask2-a PrgB1ProcFormat PrgB2Autocall PrgB3Includes PrgB4Includes inobs iproccontents iprocprint iprocsqldescribetable isyslast2xls Task 2-b: View batch, program, log, list btask2-b Task 2-c: View Excel output btask2-c Q: what do programs have in common? Task 9: clean up End Notes Use btask1-a.bat. Note that this will run either of v8 or v9.1, whichever is installed (using the standard installation) on your desktop. If you have both, then v9 will start after you close v8. btask1-a.bat 6 "C:\Program Files\SAS Institute\SAS\V8\sas" -sysin Prg0Libname1 7 "C:\Program Files\SAS\SAS 9.1\SAS" -sysin Prg0Libname1 Prg0Libname1.log 1 1 *name: Prg0Libname1.sas; 2 2 * produces an error 3 3 * without autoexec defining Library; 4 4 libname Library list; 5 ERROR: Libname LIBRARY is not assigned. 6 ERROR: Error in the LIBNAME statement. pg. 14

15 2.2 Task 1-b: Create autoexec.sas See btask1-b.bat which creates an autoexec file for this project. This batch file copies the example file, and opens it; The process is designed to create the file; you are not expected to make any changes. btask1-b.bat 1 rem name: btask1-b.bat 2 rem description: copy xautoexec.sas to autoexec.sas 3 rem open with NotePad 4 rem purpose: create autoexec.sas 5 rem note: exit NotePad: Alt-File-eXit 6 7 attrib +R xautoexec.sas 8 copy /Y xautoexec.sas autoexec.sas 9 attrib -R autoexec.sas 10 NotePad autoexec.sas Note: for an explanation of the DOS attrib and copy options (+R /Y -R) see atask1-b.bat. autoexec.sas 1 *name: autoexec.sas; 2 title1 C:\temp\setupPC-SAS\projectB ; 3 filename Pgm C:\temp\setupPC-SAS\projectB\pgm ; 4 libname Library C:\temp\setupPC-SAS\projectB\dataSAS ; 5 6 options nocenter 7 MautoSource;*enable autocall of SAS-supplied macros; 8 9 options formchar =.. ; 10 *options linesize = 80; 2.3 Task 1-c: Check Library assigned by autoexec Use btask1-c.bat. Option echoauto is necessary to show the autoexec statements in the log, otherwise only notes generated by autoexec statements are shown. btask1-c.bat 3 "C:\Program Files\SAS Institute\SAS\V8\sas" -sysin Prg0Libname2 -echoauto 4 "C:\Program Files\SAS\SAS 9.1\SAS" -sysin Prg0Libname2 -echoauto Prg0Libname2.log 20 3 filename Pgm C:\temp\setupPC-SAS\projectB\pgm ; 21 4 libname Library C:\temp\setupPC-SAS\projectB\dataSAS ; 22 NOTE: Libref LIBRARY was successfully assigned as follows: 23 Engine: V8 pg. 15

16 2.4 Task 2: Execute SAS programs btask2-a Each of the SAS programs provided has a batch file provided to run it. btask2-a.bat executes all of the programs. btask2-a.bat 1 rem name: btask2-a.bat PrgB1ProcFormat 2 3 call PrgB1ProcFormat 4 call PrgB2AutoCall 5 call PrgB3Includes 6 call PrgB4Includes PrgB1ProcFormat.sas 1 *name: PrgB1ProcFormat.sas; 2 3 PROC Format library = Library ; 4 5 value $test a = 1 6 b = 2; 7 8 value boolean 0 = false 9 1 = true 10 other = missing ; *print list of (in)formats; 13 PROC Format library = Library fmtlib; 14 title2 library = Library ; run; PrgB2Autocall PrgB2Autocall.sas 1 * name: PrgB2Autocall.sas; 2 *purpose: list SAS-supplied directories 3 * containing autocall macros; 4 5 *1. options for autocall; 6 %Put MautoSource<%sysfunc(getoption(MautoSource))>; 7 %Put SASautos <%sysfunc(getoption(sasautos ))>; 8 9 *2. use one autocall macro: verify; 10 * which makes filename SASautos; 11 %Put Test<%verify(TIME,TEMP)> position of letter <I>; filename SASautos list; 14 run; pg. 16

17 2.4.4 PrgB3Includes PrgB4Includes inobs iproccontents iprocprint PrgB3Includes.sas 1 *name: PrgB3Includes.sas; 2 Data PrgB3Includes;x=1;output;stop;run; 3 %Inc Pgm(iProcPrint); 4 %Inc Pgm(iProcContents); 5 run; PrgB4Includes.sas 1 *name: PrgB4Includes.sas; 2 Data Library.PrgB4Includes; 3 set SAShelp.Class; 4 run; 5 %Inc Pgm(iNobs); 6 %Inc Pgm(iProcSQLdescribeTable); 7 %Inc Pgm(iSysLast2xls); 8 run; inobs.sas 1 /*Nobs returns number of obs of data set in mvar Nobs 2 usage: 3 %Inc Pgm(iNobs); 4 RJF2 05Mar02 note: SysLast is padded w/blanks 5 ***... */ 6 %Let Nobs = 0; 7 DATA _Null_;if 0 then set &SysLast.(drop = _all_) 8 nobs = Nobs; 9 call symput( Nobs,compress(put(Nobs,32.)));stop; 10 %cmpres(&syslast. ): &Nobs.; iproccontents.sas 1 *name: iproccontents.sas; 2 3 PROC Contents data = &SysLast. ; 4 title2 "&SysLast."; 5 run; title2; 6 iprocprint.sas 1 *name: iprocprint.sas; 2 %Inc Pgm(iNobs);*returns mvar Nobs; 3 4 PROC Print data = &SysLast. ; 5 title2 "%cmpres(&syslast.) obs:&nobs."; 6 run; title2; iprocsqldescribetable pg. 17

18 iprocsqldescribetable.sas 1 *name: iprocsqldescribetable.sas; 2 3 PROC SQL;describe table &SysLast. ;quit; 4 title2 "&SysLast."; 5 run; title2; isyslast2xls isyslast2xls.sas 1 /*name: isyslast2xls.sas; 2 description: Write SysLast to an Excel Spreadsheet 3 ***... */ 4 %Let Data = %scan(&syslast.,2,.); 5 %Put Data<&Data.>; 6 *Let FileNameExt =&Data..xls;*write here; 7 %Let FileNameExt =C:\temp\setupPC-SAS\projectB\xls\&Data..xls; 8 9 Filename File2Del "&FileNameExt."; 10 DATA _Null_; 11 Rc = fdelete( File2Del ); 12 SysMsg = sysmsg(); 13 put Rc = SysMsg=; 14 run; 15 Filename File2Del clear; PROC Dbload dbms = Excel 18 data = &SysLast. ; 19 %*data = &Data. ; 20 path = "&FileNameExt."; 21 putnames yes; 22 *****label; 23 *****reset all; 24 limit = 0 ; 25 load; 26 run; pg. 18

19 2.5 Task 2-b: View batch, program, log, list btask2-b Each of the SAS programs provided has a batch file provided to run it. This program is a viewer for the first batch file, each program, log and list, and possibly the Excel output; otherwise see task 2-c. btask2-b.bat 1 rem name: btask2-b.bat 2 rem description: view bat, program, log and list 3 4 NotePad PrgB1ProcFormat.bat 5 NotePad PrgB1ProcFormat.sas 6 if exist PrgB1ProcFormat.log NotePad PrgB1ProcFormat.log 7 if exist PrgB1ProcFormat.lst NotePad PrgB1ProcFormat.lst 8 9 NotePad PrgB2Autocall.sas 10 if exist PrgB2Autocall.log NotePad PrgB2Autocall.log 11 if exist PrgB2Autocall.lst NotePad PrgB2Autocall.lst NotePad PrgB3Includes.sas 14 if exist PrgB3Includes.log NotePad PrgB3Includes.log 15 if exist PrgB3Includes.lst NotePad PrgB3Includes.lst NotePad PrgB4Includes.sas 18 if exist PrgB4Includes.log NotePad PrgB4Includes.log 19 if exist PrgB4Includes.lst NotePad PrgB4Includes.lst if exist..\xls\prgb4includes.xls Excel..\xls\PrgB4Includes.xls 2.6 Task 2-c: View Excel output btask2-c If btask2-b did not open Excel try this; otherwise, move to the../xls directory and open Prg4Includes.xls. pg. 19

20 btask2-c.bat 1 rem name: btask2-c.bat 2 rem description: view Excel worksheet 3 4 if not exist..\xls\prgb4includes.xls goto EOF 5 "C:\Program Files\Microsoft Office\Office10\Excel"..\xls\PrgB4Includes.xls 6 7 rem will not work if Excel.exe is not in the named folder 2.7 Q: what do programs have in common? A program has project directory reference. aareadmeb.txt 29 ProjB Q: what do SAS programs have in common? 30 A: some have hard-coded directory reference: 31 C:\temp\setupPC-SAS\projectB autoexec.sas 2 title1 C:\temp\setupPC-SAS\projectB ; 3 filename Pgm C:\temp\setupPC-SAS\projectB\pgm ; 4 libname Library C:\temp\setupPC-SAS\projectB\dataSAS ; isyslast2xls.sas 7 %Let FileNameExt =C:\temp\setupPC-SAS\projectB\xls\&Data..xls; Task 9: clean up Use btask9.bat to return ProjectB to original state. 2.9 End Notes btask9.bat 1 rem name: btask9.bat 2 rem description: clean up directory 3 rem purpose: leave clean for next exercise 4 5 rem delete specific files 6 if exist autoexec.sas del autoexec.sas 7 8 rem delete all of a kind files 9 del..\datasas\*.sas7b?at 10 del..\xls\*.xls 11 del *.log 12 del *.lst 13 del *.bak Project B contains SAS.bat and SASv8.cfg and SASv9.cfg. Did you notice what nosplash did when you executed the batch programs? pg. 20

21 1 /*name: SASv9.cfg */ SASv9.cfg 2 -SASinitialFolder C:\temp\setupPC-SAS\projectB 3 -nosplash pg. 21

22 3 Project C: create new SAS program Description 1. How to remove all hard-coded directory-references (a) Review SASv9.cfg (b) Review autoexec.sas 2. How to execute SAS programs with batch files (a) Execute all or each program with batch file(s) (b) Review batch, program, and log (c) Review output in other directories 3. How to create a new SAS program and its batch file 4. How to review new SAS program log and list Purpose 1. Show that use of environment variables in SASv?.cfg can eliminate hard-coded directory-references 2. Show how to run SAS programs in batch and review log, and output in other directories The task list for Project C is in aareadmec.txt. This file can be opened with NotePad by double-clicking on aareadmec.bat. 1 rem aareadmec.bat 2 NotePad aareadmec.txt aareadmec.bat pg. 22

23 Contents 3.1 Task 1-a: Review SASv9.cfg Task 1-b: Review autoexec.sas Task 2-a: Execute SAS programs ctask2-a ODShtml ODShtml2xls ODSrtf SASdata2xls Q: SASdata2xls: Where is macro SAS2xls? Task 2-b: Review programs and logs Task 2-c: Review output in other directories SASexe.bat Task 3-a: Create new SAS program NotePadBat.bat NotePadSAS.bat xsas.sas Task 3-b: Review programs and logs Task 9: clean up Task 1-a: Review SASv9.cfg Use ctask1-a.bat. 1 rem name: ctask1-b.bat 2 NotePad autoexec.sas 1 /*name: SASv9.cfg */ ctask1-b.bat SASv9.cfg 2 -set ProjectPath C:\temp\setupPC-SAS\projectC 3 -SASinitialFolder!ProjectPath\SASpgm 4 -nosplash pg. 23

24 3.2 Task 1-b: Review autoexec.sas Use ctask1-b.bat. 1 *name: autoexec.sas; 2 autoexec.sas 3 title1 Project C ; 4 5 filename Pgm "%sysfunc(getoption(sasinitialfolder))"; 6 libname Library..\SASdata ; 7 8 options MautoSource %*autocall on for project and site macros; 9 SASautos = (Pgm 10 C:\temp\setupPC-SAS\SASsite\macros 11 SASautos); 12 options nocenter; *options formchar =.- ; 15 *options linesize = 80; 3.3 Task 2-a: Execute SAS programs ctask2-a Each of the SAS programs provided has a batch file provided to run it. ctask2-a.bat executes all of the programs. ctask2-a.bat 1 rem name: ctask2-a.bat 2 3 call ODShtml 4 call ODShtml2xls 5 call ODSrtf 6 call SASdata2xls pg. 24

25 3.3.2 ODShtml ODShtml2xls 1 *name: ODShtml.sas; 2 ODS listing close; 3 ODShtml.sas 4 ods html body =!ProjectPath\ODShtml\SAShelp-Class.htm ; 5 6 PROC Print data = SAShelp.Class; 7 %Put "data = SAShelp.Class obs: %Nobs(data = SAShelp.Class)"; 8 title2 "data = SAShelp.Class obs: %Nobs(data = SAShelp.Class)"; 9 title3 10 file:///c:/temp/setuppc-sas/projectc/odshtml/sashelp-class.htm ; 11 run; 12 ODS html close; run; 15 ods listing;*open if in a session; 16 run; 1 *name: ODShtml2xls.sas; 2 ods listing close; 3 ODShtml2xls.sas 4 ods html body =!ProjectPath\ODSxls\SAShelp-Class.xls ; 5 6 PROC Print data = SAShelp.Class; 7 title2 "data = SAShelp.Class obs: " 8 "%Nobs(data = SAShelp.Class) "; 9 title3 10 file:///c:/temp/setuppc-sas/projectc/odsxls/sashelp-class.xls ; 11 run; 12 ods html close; 13 run; 14 ods listing; 15 run; pg. 25

26 3.3.4 ODSrtf SASdata2xls 1 *name: ODSrtf.sas; ODSrtf.sas 2 %Put ProjectPath<%sysget(ProjectPath)>; 3 ods listing close; 4 5 ods rtf body =!ProjectPath\ODSrtf\SAShelp-Class.rtf ; 6 7 PROC Print data = SAShelp.Class; 8 title2 "data = SAShelp.Class obs: " 9 "%Nobs(data = SAShelp.Class) "; 10 title3 11 file:///c:/temp/setuppc-sas/projectc/odsrtf/sashelp-class.rtf ; 12 run; 13 ods rtf close; 14 run; 15 ods listing; 16 run; 1 *name: SASdata2xls.sas; 2 3 %SAS2XLS(data = Class 4,library = SAShelp 5,path =..\xls 6 ); 7 SASdata2xls.sas 8 *file:///c:/temp/setuppc-sas/projectc/xls/class.xls; 9 run; 3.4 Q: SASdata2xls: Where is macro SAS2xls? aareadmec.txt 17 Q: SASdata2xls: Where is macro SAS2XLS? 18 A: see autoexec.sas for site macros autoexec.sas 8 options MautoSource %*autocall on for project and site macros; 9 SASautos = (Pgm 10 C:\temp\setupPC-SAS\SASsite\macros 11 SASautos); 3.5 Task 2-b: Review programs and logs aareadmec.txt 20 task 2-b: review program and log 21 use Right-Click, Open-With: NotePad 22 *!* do -NOT- check: 23 <Always Use This Program to Open These Files> 24 program: SASexe.bat pg. 26

27 3.6 Task 2-c: Review output in other directories SASexe.bat is provided to use to execute a SAS program and review the log and list SASexe.bat SASexe.bat 1 rem name: SASexe.bat 2 rem description: execute SAS program 3 rem view log and list, if present 4 rem purpose: provide single batch file 5 rem to execute and view output 6 rem usage: enable set FileName= 7 rem change this: 8 rem rem set FileName=MySASprogram 9 rem to this: 10 rem set FileName=MySASprogram rem 13 set FileName=ODShtml 14 rem set FileName=ODShtml2xls 15 rem set FileName=ODSrtf 16 rem set FileName=SASdata2xls 17 rem set FileName=MySASprogram rem delete previous listing 20 if exist %FileName%.lst del %FileName%.lst rem execute %FileName%.sas 23 if exist %FileName%.sas call %FileName% rem review log and list 26 if exist %FileName%.log NotePad %FileName%.log 27 if exist %FileName%.lst NotePad %FileName%.lst 28 exit pg. 27

28 3.7 Task 3-a: Create new SAS program In this section we examine several batch files used to create a new program and a batch file to execute it NotePadBat.bat NotePadBat.bat 1 rem name: NotePadBatch.bat 2 rem description: edit w/notepad a SAS batch program 3 rem purpose: create a new SAS batch program and open it 4 rem usage: enable set FileName= 5 rem change this: 6 rem rem set FileName=MySASprogram 7 rem to this: 8 rem set FileName=MySASprogram 9 10 rem 11 set FileName=ODShtml 12 rem set FileName=ODShtml2xls 13 rem set FileName=ODSrtf 14 rem set FileName=SASdata2xls 15 rem set FileName=MySASprogram rem if not exist %FileName%.bat copy /Y xsasv8.bat %FileName%.bat 18 if not exist %FileName%.bat copy /Y xsasv9.bat %FileName%.bat 19 NotePad %FileName%.bat 20 rem exit NotePadSAS.bat NotePadSAS.bat 1 rem name: NotePadSAS.bat 2 rem description: edit w/notepad a SAS program 3 rem purpose: create a new SAS program and open it 4 rem usage: enable set FileName= 5 rem change this: 6 rem rem set FileName=MySASprogram 7 rem to this: 8 rem set FileName=MySASprogram 9 10 rem 11 set FileName=ODShtml 12 rem set FileName=ODShtml2xls 13 rem set FileName=ODSrtf 14 rem set FileName=SASdata2xls 15 rem set FileName=MySASprogram if not exist %FileName%.sas copy /Y xsas.sas %FileName%.sas 18 NotePad %FileName%.sas 19 rem exit pg. 28

29 3.7.3 xsas.sas xsas.sas 1 /* Name: xsas.sas 2 Requirements : description: what to expect 3 purpose : why was this written? 4 5 Contexts : program group: read text data review 6 program group: import export restructure report 7 program group: review data modify data 8 program group: summarization development testing 9 program type: job module routine subroutine 10 SAS type: code generator 11 SAS type: project preparation: format 12 SAS type: caller include w/parms 13 SAS type: include w/o parms 14 SAS type: macro function macro procedure Specifications: input : parameter description 17 process: how does this work? 18 output : parameter description Information : author: Ronald J. Fehd 21 author: <MyName MyInitial. MyFamilyName> 22 notes: uses routines: subroutines: Usage Examples: 25 batch submit 26 %Include Pgm(filename) 27 %DoThis(parm = a) Change Notes: 30 ABC1 YYMonDd 31 <userid> 05Mar17 32 ***... */ 33 *PROC Contents data = SAShelp.Class; 34 *PROC Freq data = SAShelp.Class; 35 *PROC Print data = SAShelp.Class; 36 run; pg. 29

30 3.8 Task 3-b: Review programs and logs Modify SASexe.bat and use to review new program log and list. 3.9 Task 9: clean up Use ctask9.bat to return ProjectB to original state. 1 rem name: ctask9.bat 2 3 del..\odshtm\*.htm 4 del..\odshtml\*.html 5 del..\odsrtf\*.rtf 6 del..\odsxls\*.xls 7 del..\sasdata\*.sas7b?at 8 del..\xls\*.xls 9 10 del *.bak 11 del *.htm 12 del *.html 13 del *.log 14 del *.lst 15 del *.xls del MySASprogram.* del PrgA1ProcFormat.* 20 del PrgA2ReadText.* 21 del PrgA3ProcFreq.* del PrgB1ProcFormat.* 24 del PrgB2Autocall.* 25 del PrgB3Includes.* 26 del PrgB4Includes.* ctask9.bat pg. 30

31 4 Options Use these statements to examine the definition, value and group of the options used here. Define Value Use this statement to see the information about an option. 1 PROC Options define value option = sasinitialfolder; These options are discussed in this paper. AutoExec MautoSource SASuser Config SASautos Set EchoAuto SASinitialFolder Splash SysIn Option Groups Use this statement to see all the options within a group. 1 PROC Options group = logcontrol; The following groups contain the options discussed in this paper. EnvDisplay EnvFiles Install LogControl Macro pg. 31

Paper AP14 Modifying The LogParse PassInfo Macro to Provide a Link between Product Usage in Rtrace Log and Time Used in Job Log

Paper AP14 Modifying The LogParse PassInfo Macro to Provide a Link between Product Usage in Rtrace Log and Time Used in Job Log Paper AP14 Modifying The LogParse PassInfo Macro to Provide a Link between Product Usage in Rtrace Log and Time Used in Job Log Ronald J. Fehd, Centers for Disease Control and ention, Atlanta, GA, USA

More information

ABSTRACT. Paper CC-031

ABSTRACT. Paper CC-031 Paper CC-031 Using Functions SYSFUNC and IFC to Conditionally Execute Statements in Open Code Ronald J. Fehd, Centers for Disease Control and Prevention, Atlanta, GA, USA ABSTRACT Audience Keywords Information

More information

Batch and Line Mode Processing in SAS Viya

Batch and Line Mode Processing in SAS Viya Batch and Line Mode Processing in SAS Viya SAS Documentation The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2016. Batch and Line Mode Processing in SAS Viya. Cary,

More information

Customizing Your SAS Session

Customizing Your SAS Session 13 CHAPTER 2 Customizing Your SAS Session Introduction 13 Specifying System Options in the SAS Command 14 Configuration Files 15 Creating a User Configuration File 15 Specifying a User Configuration File

More information

Pros and Cons of Interactive SAS Mode vs. Batch Mode Irina Walsh, ClinOps, LLC, San Francisco, CA

Pros and Cons of Interactive SAS Mode vs. Batch Mode Irina Walsh, ClinOps, LLC, San Francisco, CA Pros and Cons of Interactive SAS Mode vs. Batch Mode Irina Walsh, ClinOps, LLC, San Francisco, CA ABSTRACT It is my opinion that SAS programs can be developed in either interactive or batch mode and produce

More information

Storing and Reusing Macros

Storing and Reusing Macros 101 CHAPTER 9 Storing and Reusing Macros Introduction 101 Saving Macros in an Autocall Library 102 Using Directories as Autocall Libraries 102 Using SAS Catalogs as Autocall Libraries 103 Calling an Autocall

More information

Procedure for Stamping Source File Information on SAS Output Elizabeth Molloy & Breda O'Connor, ICON Clinical Research

Procedure for Stamping Source File Information on SAS Output Elizabeth Molloy & Breda O'Connor, ICON Clinical Research Procedure for Stamping Source File Information on SAS Output Elizabeth Molloy & Breda O'Connor, ICON Clinical Research ABSTRACT In the course of producing a report for a clinical trial numerous drafts

More information

Getting PC SAS to Do What You Want, When You Want, How You Want Jodie Gilmore, Fulcrum Communications, Washougal, WA

Getting PC SAS to Do What You Want, When You Want, How You Want Jodie Gilmore, Fulcrum Communications, Washougal, WA Getting PC SAS to Do What You Want, When You Want, How You Want Jodie Gilmore, Fulcrum Communications, Washougal, WA ABSTRACT Searching for a file that is not where you thought it was, starting SAS up

More information

Initializing and Configuring the SAS System

Initializing and Configuring the SAS System 3 CHAPTER 1 Initializing and Configuring the SAS System Invoking SAS in the OS/390 Environment 4 Invoking SAS under TSO: the SAS CLIST 4 Invoking SAS in Batch Mode: the SAS Cataloged Procedure 5 Logging

More information

SAS 101. Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23. By Tasha Chapman, Oregon Health Authority

SAS 101. Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23. By Tasha Chapman, Oregon Health Authority SAS 101 Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23 By Tasha Chapman, Oregon Health Authority Topics covered All the leftovers! Infile options Missover LRECL=/Pad/Truncover

More information

An Introduction to SAS/SHARE, By Example

An Introduction to SAS/SHARE, By Example Paper AD01 An Introduction to SAS/SHARE, By Example Larry Altmayer, U.S. Census Bureau, Washington, DC ABSTRACT SAS/SHARE software is a useful tool for allowing several users to access and edit the same

More information

CHAPTER 1 Getting Started with SAS in UNIX Environments

CHAPTER 1 Getting Started with SAS in UNIX Environments 3 CHAPTER 1 Getting Started with SAS in UNIX Environments Starting SAS Sessions in UNIX Environments 4 Invoking SAS 4 Syntax of the SAS Command 5 Example: Invoking an Interactive SAS Session 5 What If

More information

Acknowledgments xi Preface xiii About the Author xv About This Book xvii New in the Macro Language xxi

Acknowledgments xi Preface xiii About the Author xv About This Book xvii New in the Macro Language xxi Contents Part 1 Acknowledgments xi Preface xiii About the Author xv About This Book xvii New in the Macro Language xxi Macro Basics Chapter 1 Introduction 3 1.1 Macro Facility Overview 3 1.2 Terminology

More information

SAS Display Manager Windows. For Windows

SAS Display Manager Windows. For Windows SAS Display Manager Windows For Windows Computers with SAS software SSCC Windows Terminal Servers (Winstat) Linux Servers (linstat) Lab computers DoIT Info Labs (as of June 2014) In all Labs with Windows

More information

PC and Windows Installation 32 and 64 bit Operating Systems

PC and Windows Installation 32 and 64 bit Operating Systems SUDAAN Installation Guide PC and Windows Installation 32 and 64 bit Operating Systems Release 11.0.1 Copyright 2013 by RTI International P.O. Box 12194 Research Triangle Park, NC 27709 All rights reserved.

More information

Automate Secure Transfers with SAS and PSFTP

Automate Secure Transfers with SAS and PSFTP SESUG Paper 115-2017 Automate Secure Transfers with SAS and PSFTP Kyle Thompson, PPD, Morrisville, NC Kenneth W. Borowiak, PPD, Morrisville, NC INTRODUCTION The ability to transfer files between remote

More information

SAS/ACCESS Interface to R/3

SAS/ACCESS Interface to R/3 9.1 SAS/ACCESS Interface to R/3 User s Guide The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2004. SAS/ACCESS 9.1 Interface to R/3: User s Guide. Cary, NC: SAS Institute

More information

SAS. Studio 4.1: User s Guide. SAS Documentation

SAS. Studio 4.1: User s Guide. SAS Documentation SAS Studio 4.1: User s Guide SAS Documentation The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2016. SAS Studio 4.1: User s Guide. Cary, NC: SAS Institute Inc. SAS

More information

A Table Driven ODS Macro Diane E. Brown, exponential Systems, Indianapolis, IN

A Table Driven ODS Macro Diane E. Brown, exponential Systems, Indianapolis, IN A Table Driven ODS Macro Diane E. Brown, exponential Systems, Indianapolis, IN ABSTRACT Tired of coding ODS statements and SAS output procedures for every report you write and having redundant or similar

More information

SAS Studio 4.3: User s Guide

SAS Studio 4.3: User s Guide SAS Studio 4.3: User s Guide SAS Documentation December 4, 2017 The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2017. SAS Studio 4.3: User s Guide. Cary, NC: SAS Institute

More information

Introduction to the SAS System

Introduction to the SAS System Introduction to the SAS System The SAS Environment The SAS Environment The SAS Environment has five main windows The SAS Environment The Program Editor The SAS Environment The Log: Notes, Warnings and

More information

SAS System Options are Your Friends Edward Heaton, Westat, Rockville, MD

SAS System Options are Your Friends Edward Heaton, Westat, Rockville, MD SAS System Options are Your Friends Edward Heaton, Westat, Rockville, MD Abstract Does SAS always do things the way you want? Have you ever made a simple little mistake of omission with disastrous consequences?

More information

INTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS

INTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS TO SAS NEED FOR SAS WHO USES SAS WHAT IS SAS? OVERVIEW OF BASE SAS SOFTWARE DATA MANAGEMENT FACILITY STRUCTURE OF SAS DATASET SAS PROGRAM PROGRAMMING LANGUAGE ELEMENTS OF THE SAS LANGUAGE RULES FOR SAS

More information

SAS Studio 4.4: User s Guide

SAS Studio 4.4: User s Guide SAS Studio 4.4: User s Guide SAS Documentation July 6, 2018 The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2018. SAS Studio 4.4: User s Guide. Cary, NC: SAS Institute

More information

Autocall Macros A Quick Overview

Autocall Macros A Quick Overview Paper P005 Autocall Macros A Quick Overview Vinod Panangattiri Parambil, Roche Products Ltd, Welwyn Garden City, United Kingdom AUTOCALL MACRO Autocall macro is a facility within the SAS system in order

More information

BASICS BEFORE STARTING SAS DATAWAREHOSING Concepts What is ETL ETL Concepts What is OLAP SAS. What is SAS History of SAS Modules available SAS

BASICS BEFORE STARTING SAS DATAWAREHOSING Concepts What is ETL ETL Concepts What is OLAP SAS. What is SAS History of SAS Modules available SAS SAS COURSE CONTENT Course Duration - 40hrs BASICS BEFORE STARTING SAS DATAWAREHOSING Concepts What is ETL ETL Concepts What is OLAP SAS What is SAS History of SAS Modules available SAS GETTING STARTED

More information

What Is SAS? CHAPTER 1 Essential Concepts of Base SAS Software

What Is SAS? CHAPTER 1 Essential Concepts of Base SAS Software 3 CHAPTER 1 Essential Concepts of Base SAS Software What Is SAS? 3 Overview of Base SAS Software 4 Components of the SAS Language 4 SAS Files 4 SAS Data Sets 5 External Files 5 Database Management System

More information

Moving Data and Results Between SAS and Excel. Harry Droogendyk Stratia Consulting Inc.

Moving Data and Results Between SAS and Excel. Harry Droogendyk Stratia Consulting Inc. Moving Data and Results Between SAS and Excel Harry Droogendyk Stratia Consulting Inc. Introduction SAS can read ( and write ) anything Introduction In the end users want EVERYTHING in. Introduction SAS

More information

Providing Users with Access to the SAS Data Warehouse: A Discussion of Three Methods Employed and Supported

Providing Users with Access to the SAS Data Warehouse: A Discussion of Three Methods Employed and Supported Providing Users with Access to the SAS Data Warehouse: A Discussion of Three Methods Employed and Supported Cynthia A. Stetz, Merrill Lynch, Plainsboro, NJ Abstract A Data Warehouse is stored in SAS datasets

More information

Paper PO32. NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.

Paper PO32. NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead. Paper PO32 A Hacker s Guide to SAS Environment Customization Brian Fairfield-Carter, PRA International, Victoria, BC (Canada) Stephen Hunt, PRA International, Victoria, BC (Canada) ABSTRACT Most SAS users

More information

Using SAS Files CHAPTER 3

Using SAS Files CHAPTER 3 77 CHAPTER 3 Using SAS Files Introduction to SAS Files 78 What Is a SAS File? 78 Types of SAS Files 79 Using Short or Long File Extensions in SAS Libraries 80 SAS Data Sets (Member Type: Data or View)

More information

SAS Studio 3.7: User s Guide

SAS Studio 3.7: User s Guide SAS Studio 3.7: User s Guide SAS Documentation September 15, 2017 The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2017. SAS Studio 3.7: User s Guide. Cary, NC: SAS

More information

Calculating Cardinality Ratio in Two Steps

Calculating Cardinality Ratio in Two Steps MWSUG 2016 Paper TT03 Calculating Cardinality Ratio in Two Steps Ronald J. Fehd, Stakana Analytics Abstract Description: Purpose: Audience: Keywords: The cardinality of a set is the number of elements

More information

STA 303 / 1002 Using SAS on CQUEST

STA 303 / 1002 Using SAS on CQUEST STA 303 / 1002 Using SAS on CQUEST A review of the nuts and bolts A.L. Gibbs January 2012 Some Basics of CQUEST If you don t already have a CQUEST account, go to www.cquest.utoronto.ca and request one.

More information

Chapter 1: Introduction to SAS

Chapter 1: Introduction to SAS Chapter 1: Introduction to SAS SAS programs: A sequence of statements in a particular order. Rules for SAS statements: 1. Every SAS statement ends in a semicolon!!!; 2. Upper/lower case does not matter

More information

2. Don t forget semicolons and RUN statements The two most common programming errors.

2. Don t forget semicolons and RUN statements The two most common programming errors. Randy s SAS hints March 7, 2013 1. Always begin your programs with internal documentation. * ***************** * Program =test1, Randy Ellis, March 8, 2013 ***************; 2. Don t forget semicolons and

More information

Lab #1: Introduction to Basic SAS Operations

Lab #1: Introduction to Basic SAS Operations Lab #1: Introduction to Basic SAS Operations Getting Started: OVERVIEW OF SAS (access lab pages at http://www.stat.lsu.edu/exstlab/) There are several ways to open the SAS program. You may have a SAS icon

More information

Using an ICPSR set-up file to create a SAS dataset

Using an ICPSR set-up file to create a SAS dataset Using an ICPSR set-up file to create a SAS dataset Name library and raw data files. From the Start menu, launch SAS, and in the Editor program, write the codes to create and name a folder in the SAS permanent

More information

Package SASmarkdown. R topics documented: November 30, Version Date Title 'SAS' Markdown

Package SASmarkdown. R topics documented: November 30, Version Date Title 'SAS' Markdown Version 0.4.3 Date 2017-11-30 Title 'SAS' Markdown Package SASmarkdown November 30, 2017 Settings and functions to extend the 'knitr' 'SAS' engine. Imports knitr SystemRequirements SAS Maintainer

More information

Learn to Impress - Hidden base SAS features. Peter Crawford Crawford Software Consultancy Limited 1 of 21

Learn to Impress - Hidden base SAS features. Peter Crawford Crawford Software Consultancy Limited 1 of 21 Peter Crawford Crawford Software Consultancy Limited 1 of 21 Learn hidden features in base SAS to impress colleagues Peter Crawford So many features So much to learn So much being added to SAS languages

More information

APPENDIX 4 Migrating from QMF to SAS/ ASSIST Software. Each of these steps can be executed independently.

APPENDIX 4 Migrating from QMF to SAS/ ASSIST Software. Each of these steps can be executed independently. 255 APPENDIX 4 Migrating from QMF to SAS/ ASSIST Software Introduction 255 Generating a QMF Export Procedure 255 Exporting Queries from QMF 257 Importing QMF Queries into Query and Reporting 257 Alternate

More information

Reading a Column into a Row to Count N-levels, Calculate Cardinality Ratio and Create Frequency and Summary Output In One Step

Reading a Column into a Row to Count N-levels, Calculate Cardinality Ratio and Create Frequency and Summary Output In One Step Paper RF-04-2015 Reading a Column into a Row to Count N-levels, Calculate Cardinality Ratio and Create Frequency and Summary Output In One Step Ronald J. Fehd, Stakana Analytics Abstract Description :

More information

Procedures. PROC CATALOG CATALOG=<libref.>catalog <ENTRYTYPE=etype> <KILL>; CONTENTS <OUT=SAS-data-set> <FILE=fileref;>

Procedures. PROC CATALOG CATALOG=<libref.>catalog <ENTRYTYPE=etype> <KILL>; CONTENTS <OUT=SAS-data-set> <FILE=fileref;> 355 CHAPTER 19 Procedures SAS Procedures under Windows 355 CATALOG 355 CIMPORT 356 CONTENTS 357 CONVERT 358 CPORT 361 DATASETS 361 OPTIONS 363 PMENU 364 PRINTTO 365 SORT 367 SAS Procedures under Windows

More information

SAS Viya 3.1 FAQ for Processing UTF-8 Data

SAS Viya 3.1 FAQ for Processing UTF-8 Data SAS Viya 3.1 FAQ for Processing UTF-8 Data Troubleshooting Tips for Processing UTF-8 Data (Existing SAS Code) What Is the Encoding of My Data Set? PROC CONTENTS displays information about the data set

More information

Using SAS Files CHAPTER 3

Using SAS Files CHAPTER 3 55 CHAPTER 3 Using SAS Files Introduction to SAS Files 56 What Is a SAS File? 56 Types of SAS Files 57 Using Short or Long File Extensions in SAS Libraries 58 SAS Data Sets (Member Type: Data or View)

More information

Administering SAS Enterprise Guide 4.2

Administering SAS Enterprise Guide 4.2 Administering SAS Enterprise Guide 4.2 SAS Documentation The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2009. Administering SAS Enterprise Guide 4.2. Cary, NC: SAS

More information

Tracking Dataset Dependencies in Clinical Trials Reporting

Tracking Dataset Dependencies in Clinical Trials Reporting Tracking Dataset Dependencies in Clinical Trials Reporting Binoy Varghese, Cybrid Inc., Wormleysburg, PA Satyanarayana Mogallapu, IT America Inc., Edison, NJ ABSTRACT Most clinical trials study reporting

More information

SAS Studio 3.6: User s Guide

SAS Studio 3.6: User s Guide SAS Studio 3.6: User s Guide SAS Documentation June 2017 The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2016. SAS Studio 3.6: User s Guide. Cary, NC: SAS Institute

More information

Diagnosing SAS Enterprise Guide 4.1 Connectivity Problems Using the SAS Integration Technologies Configuration Utility TS-790

Diagnosing SAS Enterprise Guide 4.1 Connectivity Problems Using the SAS Integration Technologies Configuration Utility TS-790 Diagnosing SAS Enterprise Guide 4.1 Connectivity Problems Using the SAS Integration Technologies Configuration Utility TS-790 Diagnosing SAS Enterprise Guide Connectivity Problems Using the SAS Integration

More information

Contents of SAS Programming Techniques

Contents of SAS Programming Techniques Contents of SAS Programming Techniques Chapter 1 About SAS 1.1 Introduction 1.1.1 SAS modules 1.1.2 SAS module classification 1.1.3 SAS features 1.1.4 Three levels of SAS techniques 1.1.5 Chapter goal

More information

SAS Online Training: Course contents: Agenda:

SAS Online Training: Course contents: Agenda: SAS Online Training: Course contents: Agenda: (1) Base SAS (6) Clinical SAS Online Training with Real time Projects (2) Advance SAS (7) Financial SAS Training Real time Projects (3) SQL (8) CV preparation

More information

A Mass Symphony: Directing the Program Logs, Lists, and Outputs

A Mass Symphony: Directing the Program Logs, Lists, and Outputs PharmaSUG2011 Paper CC24 ABSTRACT A Mass Symphony: Directing the Program Logs, Lists, and Outputs Tom Santopoli, Octagon Research Solutions, Inc., Wayne, PA When executing programs in SAS, it is efficient

More information

Why & How To Use SAS Macro Language: Easy Ways To Get More Value & Power from Your SAS Software Tools

Why & How To Use SAS Macro Language: Easy Ways To Get More Value & Power from Your SAS Software Tools Why & How To Use SAS Macro Language: Easy Ways To Get More Value & Power from Your SAS Software Tools LeRoy Bessler PhD Bessler Consulting and Research Strong Smart Systems Mequon, WI, USA Le_Roy_Bessler@wi.rr.com

More information

Big Data Executive Program

Big Data Executive Program Big Data Executive Program Big Data Executive Program Business Visualization for Big Data (BV) SAS Visual Analytics help people see things that were not obvious to them before. Even when data volumes are

More information

Compute Service: A RESTful Approach to the SAS Programming Environment

Compute Service: A RESTful Approach to the SAS Programming Environment Paper SAS2083-2018 Compute Service: A RESTful Approach to the SAS Programming Environment Jason Spruill and Joseph Henry, SAS Institute Inc., Cary, NC ABSTRACT SAS Viya provides an open architecture that

More information

TIPS AND TRICKS: IMPROVE EFFICIENCY TO YOUR SAS PROGRAMMING

TIPS AND TRICKS: IMPROVE EFFICIENCY TO YOUR SAS PROGRAMMING TIPS AND TRICKS: IMPROVE EFFICIENCY TO YOUR SAS PROGRAMMING Guillaume Colley, Lead Data Analyst, BCCFE Page 1 Contents Customized SAS Session Run system options as SAS starts Labels management Shortcut

More information

SAS System Options are Your Friends Edward Heaton, Westat, Rockville, MD

SAS System Options are Your Friends Edward Heaton, Westat, Rockville, MD Paper TU07 SAS System Options are Your Friends Edward Heaton, Westat, Rockville, MD Abstract Does SAS always do things the way you want? Have you ever made a simple little mistake of omission with disastrous

More information

F9 V5 Installation for Citrix Server

F9 V5 Installation for Citrix Server F9 V5 Installation for Citrix Server Installation: Installing F9 on a Citrix Server (Terminal Services) has to be done using the Control Panel. Steps: 1. Control Panel + Programs + Install on Remote Desktop

More information

Applications Design and Development, a case study of the EDA Summarize-Each-Variable Suite

Applications Design and Development, a case study of the EDA Summarize-Each-Variable Suite Paper HOW96 Applications Design and Development, a case study of the EDA Summarize-Each-Variable Suite Ronald J. Fehd Theoretical Programmer Senior Maverick Stakana Analytics Abstract Description : This

More information

A Beginner s Tour of a Project using SAS Macros Led by SAS-L s Macro Maven Ronald Fehd, Centers for Disease Control and Prevention, Atlanta, GA, USA

A Beginner s Tour of a Project using SAS Macros Led by SAS-L s Macro Maven Ronald Fehd, Centers for Disease Control and Prevention, Atlanta, GA, USA A Beginner s Tour of a Project using SAS Macros Led by SAS-L s Macro Maven Ronald Fehd, Centers for Disease Control and Prevention, Atlanta, GA, USA ABSTRACT SAS Macros and the SAS Macro Language are simple

More information

SAS/Warehouse Administrator Usage and Enhancements Terry Lewis, SAS Institute Inc., Cary, NC

SAS/Warehouse Administrator Usage and Enhancements Terry Lewis, SAS Institute Inc., Cary, NC SAS/Warehouse Administrator Usage and Enhancements Terry Lewis, SAS Institute Inc., Cary, NC ABSTRACT SAS/Warehouse Administrator software makes it easier to build, maintain, and access data warehouses

More information

STAT:5400 Computing in Statistics

STAT:5400 Computing in Statistics STAT:5400 Computing in Statistics Introduction to SAS Lecture 18 Oct 12, 2015 Kate Cowles 374 SH, 335-0727 kate-cowles@uiowaedu SAS SAS is the statistical software package most commonly used in business,

More information

SAS Enterprise Guide 4.3

SAS Enterprise Guide 4.3 Administering SAS Enterprise Guide 4.3 SAS Documentation The correct bibliographic citation for this manual is as follows: SAS Institute Inc 2010. Administering SAS Enterprise Guide 4.3. Cary, NC: SAS

More information

(on CQUEST) A.L. Gibbs

(on CQUEST) A.L. Gibbs STA 302 / 1001 Introduction to SAS for Regression (on CQUEST) A.L. Gibbs September 2009 1 Some Basics of CQUEST The operating system in the RW labs (107/109 and 211) is Windows XP. There are a few terminals

More information

Installation Instructions for JMP Genomics 7.1

Installation Instructions for JMP Genomics 7.1 Installation Instructions for JMP Genomics 7.1 These instructions describe the process for downloading and installing JMP Genomics 7.1 on your Windows desktop machine. These instructions include two major

More information

The REPORT Procedure CHAPTER 32

The REPORT Procedure CHAPTER 32 859 CHAPTER 32 The REPORT Procedure Overview 861 Types of Reports 861 A Sampling of Reports 861 Concepts 866 Laying Out a Report 866 Usage of Variables in a Report 867 Display Variables 867 Order Variables

More information

Functions vs. Macros: A Comparison and Summary

Functions vs. Macros: A Comparison and Summary Functions vs. Macros: A Comparison and Summary Mahipal Vanam Phaneendhar Vanam Srinivas Vanam Percept Pharma Services, Bridgewater, NJ ABSTRACT SAS is rich in various built-in functions, and predefined

More information

3. Almost always use system options options compress =yes nocenter; /* mostly use */ options ps=9999 ls=200;

3. Almost always use system options options compress =yes nocenter; /* mostly use */ options ps=9999 ls=200; Randy s SAS hints, updated Feb 6, 2014 1. Always begin your programs with internal documentation. * ***************** * Program =test1, Randy Ellis, first version: March 8, 2013 ***************; 2. Don

More information

Installation and Configuration Instructions. SAS Model Manager API. Overview

Installation and Configuration Instructions. SAS Model Manager API. Overview Installation and Configuration Instructions SAS Model Manager 2.1 This document is intended to guide an administrator through the pre-installation steps, the installation process, and post-installation

More information

Some Basics of CQUEST

Some Basics of CQUEST Some Basics of CQUEST The operating system in RW labs (107/109 and 211) is Windows XP. There are a few terminals in RW 213 running Linux. SAS is run from a Linux Server. Your account is the same and files

More information

SAS Data Libraries. Definition CHAPTER 26

SAS Data Libraries. Definition CHAPTER 26 385 CHAPTER 26 SAS Data Libraries Definition 385 Library Engines 387 Library Names 388 Physical Names and Logical Names (Librefs) 388 Assigning Librefs 388 Associating and Clearing Logical Names (Librefs)

More information

Macros to Manage your Macros? Garrett Weaver, University of Southern California, Los Angeles, CA

Macros to Manage your Macros? Garrett Weaver, University of Southern California, Los Angeles, CA Macros to Manage your Macros? Garrett Weaver, University of Southern California, Los Angeles, CA ABSTRACT SAS currently offers several methods for users to store and retrieve user-generated macros. The

More information

Macro Facility. About the Macro Facility. Automatic Macro Variables CHAPTER 14

Macro Facility. About the Macro Facility. Automatic Macro Variables CHAPTER 14 213 CHAPTER 14 Macro Facility About the Macro Facility 213 Automatic Macro Variables 213 Macro Statements 215 Macro Functions 215 SAS System Options Used by the Macro Facility 216 Using Autocall Libraries

More information

PCKG: Managing SAS Macro Libraries. Magnus Mengelbier, Limelogic Ltd, London, United Kingdom

PCKG: Managing SAS Macro Libraries. Magnus Mengelbier, Limelogic Ltd, London, United Kingdom Paper CC06 PCKG: Managing SAS Macro Libraries Magnus Mengelbier, Limelogic Ltd, London, United Kingdom ABSTRACT Development of standard SAS macro libraries is a continuous exercise in feature development,

More information

WPS Workbench. user guide. "To help guide you through using the WPS user interface (Workbench) to create, edit and run programs"

WPS Workbench. user guide. To help guide you through using the WPS user interface (Workbench) to create, edit and run programs WPS Workbench user guide "To help guide you through using the WPS user interface (Workbench) to create, edit and run programs" Version: 3.1.7 Copyright 2002-2018 World Programming Limited www.worldprogramming.com

More information

Download Instructions

Download Instructions Download Instructions The download page provides several options for importing data back into your applications. The Excel template will automatically format the data within the commadelimited file. The

More information

Reading and Writing Data from Microsoft Excel/Word Using DDE

Reading and Writing Data from Microsoft Excel/Word Using DDE Reading and Writing Data from Microsoft Excel/Word Using DDE The DDE Triplet is then incorporated into a Filename statement of the following form: FILENAME fileref DDE 'DDE-Triplet' 'CLIPBOARD' ;

More information

Configuration Guide for SAS Activity-Based Management Adapter 6.2 for SAP R/3

Configuration Guide for SAS Activity-Based Management Adapter 6.2 for SAP R/3 Configuration Guide for SAS Activity-Based Management Adapter 6.2 for SAP R/3 Copyright Notice The correct bibliographic citation for this manual is as follows: SAS Institute Inc., Configuration Guide

More information

(on CQUEST) A.L. Gibbs

(on CQUEST) A.L. Gibbs STA 302 / 1001 Introduction to SAS for Regression (on CQUEST) A.L. Gibbs September 2007 1 Some Basics of CQUEST The operating system in the ESC lab (1046) is Linux. The operating system in the RW labs

More information

April 4, SAS General Introduction

April 4, SAS General Introduction PP 105 Spring 01-02 April 4, 2002 SAS General Introduction TA: Kanda Naknoi kanda@stanford.edu Stanford University provides UNIX computing resources for its academic community on the Leland Systems, which

More information

SAS Studio: A New Way to Program in SAS

SAS Studio: A New Way to Program in SAS SAS Studio: A New Way to Program in SAS Lora D Delwiche, Winters, CA Susan J Slaughter, Avocet Solutions, Davis, CA ABSTRACT SAS Studio is an important new interface for SAS, designed for both traditional

More information

Epidemiology Principles of Biostatistics Chapter 3. Introduction to SAS. John Koval

Epidemiology Principles of Biostatistics Chapter 3. Introduction to SAS. John Koval Epidemiology 9509 Principles of Biostatistics Chapter 3 John Koval Department of Epidemiology and Biostatistics University of Western Ontario What we will do today We will learn to use use SAS to 1. read

More information

A Macro To Generate a Study Report Hany Aboutaleb, Biogen Idec, Cambridge, MA

A Macro To Generate a Study Report Hany Aboutaleb, Biogen Idec, Cambridge, MA Paper PO26 A Macro To Generate a Study Report Hany Aboutaleb, Biogen Idec, Cambridge, MA Abstract: Imagine that you are working on a study (project) and you would like to generate a report for the status

More information

Applications Development

Applications Development Two Steps to LIBNAME-Free Coding: Use of Macro Parameters and AUTOEXEC.SAS Zhengyi Fang, Social & Scientific Systems, Inc., Silver Spring, MD Paul Gorrell, IMPAQ International, LLC, Columbia, MD ABSTRACT

More information

Better Metadata Through SAS II: %SYSFUNC, PROC DATASETS, and Dictionary Tables

Better Metadata Through SAS II: %SYSFUNC, PROC DATASETS, and Dictionary Tables Paper 3458-2015 Better Metadata Through SAS II: %SYSFUNC, PROC DATASETS, and Dictionary Tables ABSTRACT Louise Hadden, Abt Associates Inc., Cambridge, MA SAS provides a wealth of resources for users to

More information

AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike Zdeb, School of Public Health

AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike Zdeb, School of Public Health AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike Zdeb, University@Albany School of Public Health INTRODUCTION There are a number of SAS tools that you may never have to use. Why? The main reason

More information

SAS Intelligence Platform to 9.2 Migration Guide

SAS Intelligence Platform to 9.2 Migration Guide SAS Intelligence Platform 9.1.3 to 9.2 Migration Guide The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2009. SAS Intelligence Platform: 9.1.3 to 9.2 Migration Guide,

More information

Changes and Enhancements

Changes and Enhancements vii Changes and Enhancements Introduction This section describes the features of SAS System under OS/2 that have been implemented or enhanced since Release 6.12. Version 8 changes and enhancements are

More information

SAS Training BASE SAS CONCEPTS BASE SAS:

SAS Training BASE SAS CONCEPTS BASE SAS: SAS Training BASE SAS CONCEPTS BASE SAS: Dataset concept and creating a dataset from internal data Capturing data from external files (txt, CSV and tab) Capturing Non-Standard data (date, time and amounts)

More information

SAS. IT Resource Management 2.7: Glossary

SAS. IT Resource Management 2.7: Glossary SAS IT Resource Management 2.7: Glossary The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2004. SAS IT Resource Management 2.7: Glossary. Cary, NC: SAS Institute Inc.

More information

Basic Concept Review

Basic Concept Review Basic Concept Review Quiz Using the Programming Workspace Referencing Files and Setting Options Editing and Debugging SAS Programs End of Review SAS Format Format Formats are variable

More information

USING DATA TO SET MACRO PARAMETERS

USING DATA TO SET MACRO PARAMETERS USING DATA TO SET MACRO PARAMETERS UPDATE A PREVIOUS EXAMPLE %macro report(regs=); %let r=1; %let region=%scan(&regs,&r); %do %until(&region eq ); options nodate pageno=1; ods pdf file="&region..pdf";

More information

ABSTRACT MORE THAN SYNTAX ORGANIZE YOUR WORK THE SAS ENTERPRISE GUIDE PROJECT. Paper 50-30

ABSTRACT MORE THAN SYNTAX ORGANIZE YOUR WORK THE SAS ENTERPRISE GUIDE PROJECT. Paper 50-30 Paper 50-30 The New World of SAS : Programming with SAS Enterprise Guide Chris Hemedinger, SAS Institute Inc., Cary, NC Stephen McDaniel, SAS Institute Inc., Cary, NC ABSTRACT SAS Enterprise Guide (with

More information

OASUS Spring 2014 Questions and Answers

OASUS Spring 2014 Questions and Answers OASUS Spring 2014 Questions and Answers The following answers are provided to the benefit of the OASUS Users Group and are not meant to replace SAS Technical Support. Also, the Enterprise Guide project

More information

CC13 An Automatic Process to Compare Files. Simon Lin, Merck & Co., Inc., Rahway, NJ Huei-Ling Chen, Merck & Co., Inc., Rahway, NJ

CC13 An Automatic Process to Compare Files. Simon Lin, Merck & Co., Inc., Rahway, NJ Huei-Ling Chen, Merck & Co., Inc., Rahway, NJ CC13 An Automatic Process to Compare Files Simon Lin, Merck & Co., Inc., Rahway, NJ Huei-Ling Chen, Merck & Co., Inc., Rahway, NJ ABSTRACT Comparing different versions of output files is often performed

More information

Using UNIX Shell Scripting to Enhance Your SAS Programming Experience

Using UNIX Shell Scripting to Enhance Your SAS Programming Experience Paper 2412-2018 Using UNIX Shell Scripting to Enhance Your SAS Programming Experience James Curley, Eliassen Group ABSTRACT This series will address three different approaches to using a combination of

More information

SAS Intelligence Platform to 9.2 Migration Guide

SAS Intelligence Platform to 9.2 Migration Guide SAS Intelligence Platform 9.1.3 to 9.2 Migration Guide The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2009. SAS Intelligence Platform: 9.1.3 to 9.2 Migration Guide.

More information

University of North Dakota PeopleSoft Finance Tip Sheets. Utilizing the Query Download Feature

University of North Dakota PeopleSoft Finance Tip Sheets. Utilizing the Query Download Feature There is a custom feature available in Query Viewer that allows files to be created from queries and copied to a user s PC. This feature doesn t have the same size limitations as running a query to HTML

More information

Importing and Exporting Data

Importing and Exporting Data 14 Importing and Exporting Data SKILL SUMMARY Skills Exam Objective Objective Number Importing Data Import data into tables. Append records from external data. Import tables from other databases. Create

More information

FSEDIT Procedure Windows

FSEDIT Procedure Windows 25 CHAPTER 4 FSEDIT Procedure Windows Overview 26 Viewing and Editing Observations 26 How the Control Level Affects Editing 27 Scrolling 28 Adding Observations 28 Entering and Editing Variable Values 28

More information