Presentation on theme: "1 Appendix A: Writing and Submitting SAS ® Programs A.1 Writing and Submitting SAS Programs."— Presentation transcript:
1 Appendix A: Writing and Submitting SAS ® Programs A.1 Writing and Submitting SAS Programs
2 Objectives Create and submit new SAS programs. Insert existing programs into a project. List programming statements to avoid. Generate a combined project program and log.
3 SAS Enterprise Guide Program Editor SAS Enterprise Guide includes a programming editor similar to the Enhanced Program Editor. Additional functionality in the SAS Enterprise Guide 4.3 Program Editor includes the following: autocomplete dynamic syntax tooltips formatting programs to provide consistent spacing analyzing program flow
4 Writing a New SAS Program To build a SAS program, select File New Program to create a new code node in the project. The new program is saved along with the project.
5 Adding Existing Code To add a shortcut in the project to an existing SAS program, select File Open Program….
6 Running SAS Code A SAS program can be submitted using one of these techniques: Select Run or Run Selection from the toolbar. Select Program Run or Run Selection from the Menu bar. Right-click on the program and select Run or Run Selection. Press F8 or F3.
7 Accessing Program, Log and Results The code, log, output data, and results are accessible via separate tabs.
8 Identifying Warning and Errors in the Log The code icons in the project indicate whether there are warnings or errors in the SAS log. Arrows on the Log tab enable quick navigation to the next warning or error.
10 A.01 Quiz Open the SAS program e1Aa01.sas in SAS Enterprise Guide and run it. Look at the log to identify any errors, correct the program, and rerun it. Leave the project and program open for the next quiz. e1Aa01.sas
11 A.01 Quiz – Correct Answer Open the SAS program e1Aa01.sas in SAS Enterprise Guide and run it. Look at the log to identify any errors, correct the program, and rerun it. The data set should be named children. e1Aa01.sas
12 Using the Program Toolbar A toolbar above the program offers easy access to common actions, such as the following: saving the program running or stopping a program selecting the execution server analyzing the program for flow or grid computing exporting and e-mailing creating a stored process modifying program properties
13 Embedding Programs in a Project New SAS programs are embedded in the project so that it is saved as part of the.egp file. When an existing SAS program is added to a project, a shortcut to the program file is created. You can also embed the program so that it is stored as part of the project file. Select Properties from the Program toolbar and select Embed.
14 A.02 Quiz Embed the e1Aa01 program into the project by selecting the Properties button on the Program tab and selecting Embed OK. View the process flow. How does the Code icon change? e1Aa01.sas
15 A.02 Quiz – Correct Answer Embed the e1Aa01 program into the project by selecting the Properties button on the Program tab and selecting Embed OK. View the process flow. How does the Code icon change? The shortcut arrow is removed. e1Aa01.sas
16 Using Autocomplete In SAS Enterprise Guide 4.3, the Program Editor includes an autocomplete feature. The editor can suggest SAS statements procedures macro programs macro variables functions formats librefs SAS data sets.
17 Customizing the Program Editor The Program Editor can be customized by selecting Program Editor Options. Autocomplete can be customized or disabled on the Autocomplete tab.
19 Linking Items in the Process Flow Links define the directional relationship between objects in SAS Enterprise Guide to create a process flow. Links can be either automatic or user-defined. Links can enable you to force a particular flow between programs and point-and-click tasks in the project. User-Defined Automatic
20 Adding a SAS Program to a Project This demonstration illustrates adding and submitting a SAS program in a SAS Enterprise Guide project.
21 Exporting Code All SAS code within a project can be exported to a file that can be edited and executed in other SAS environments. Select File Export Export All Code in Project….
22 Project Log The project log can be used to maintain and export an aggregated log of all code submitted for the project.
24 Setup for the Poll 1.Open the e1Aa01.egp project. 2.Select Project Log in the Process Flow window or select View Project Log. 3.Select Turn On. 4.Return to the Process Flow window and select Run Process Flow. 5.After the results are generated, select Run Process Flow a second time. 6.Examine the project log by selecting View Project Log.
25 A.03 Poll Is the project log overwritten or appended when the project is run the second time? Overwritten Appended
26 A.03 Poll – Correct Answer Is the project log overwritten or appended when the project is run the second time? Overwritten Appended
27 Programming Statements to Avoid Programs that run in the SAS windowing environment can also run successfully in SAS Enterprise Guide. Be aware of the following exceptions: Code that calls X commands or SYSTASK might not work unless this permission is granted by the administrator. Code that would normally cause a window or prompt to appear in the SAS windowing environment (DEBUG, PROC FSLIST, AF applications) does not work in SAS Enterprise Guide. Code that terminates the SAS process with ABORT or ENDSAS calls terminates the connection between SAS Enterprise Guide and the SAS server.