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 Errors
The SAS Environment The Explorer: Navigation of SAS Libraries
Running/Submitting a Program Open Demo Code 1 from \\seashare\blumj\stt 305 You may use File Open Program or the Open icon, provided the Program Editor is the active window.
Running/Submitting a Program To run a program
Running/Submitting a Program Click on the running man
Running/Submitting a Program Select submit from the run menu
Running/Submitting a Program Or press F8 on your keyboard
Output Depending on the settings for your session, output may be generated in different ways. SAS 9.4 default is HTML, but we ll change to listing (output window). Caveat: Not all code generates output (and some generates different types).
Output-HTML
Output Changing to Listing
Output Changing to Listing Uncheck Create HTML, Check Create listing
Output--Listing The Output Window
Output--Listing The Results Window provides bookmarks for all output
Managing Results Multiple program submissions can (and likely will) be made in a given session. In fact, blocks of code can be submitted individually. Submissions are cumulative in both the log and output windows.
Managing Results Since log and output results are cumulative, clearing windows is often necessary. You can clear a window by
Managing Results Typing clear into the command box
Managing Results Selecting Clear All from the edit menu
Assigning Hotkeys The function keys and other key combinations can be mapped to certain commands. To bring up the keys window type keys in the command box or press F9. Any legal SAS commands can be used, multiple commands are separated by semicolons.
Assigning Hotkeys I have F12 mapped to a series of commands that clear the log and output windows and return me to the program editor.
Looking at the Code options nodate pageno=1; proc means data=sashelp.cars min q1 median q3 max; class origin; var mpg_city mpg_highway; run; proc freq data=sashelp.cars; table origin*type; run; quit;
Looking at the Code options nodate pageno=1; proc means data=sashelp.cars min q1 median q3 max; class origin; var mpg_city mpg_highway; run; proc freq data=sashelp.cars; table origin*type; run; quit; All statements end with a semicolon
Looking at the Code options nodate pageno=1; proc means data=sashelp.cars min q1 median q3 max; class origin; var mpg_city mpg_highway; run; proc freq data=sashelp.cars; table origin*type; run; quit; Options is a global statement stands alone
Looking at the Code options nodate pageno=1; proc means data=sashelp.cars min q1 median q3 max; class origin; var mpg_city mpg_highway; run; proc freq data=sashelp.cars; table origin*type; run; quit; Procedures PROC for short are blocks of code used for a variety of tasks in SAS
Looking at the Code options nodate pageno=1; proc means data=sashelp.cars min q1 median q3 max; class origin; var mpg_city mpg_highway; run; proc freq data=sashelp.cars; table origin*type; run; quit; One option nearly always required for a procedure is a data set
Data Set Names In any SAS session, SAS data sets have two level names: libref.filename Library Name Data Set Name If the libref is omitted (along with the. ), the work library is taken as default.
Libraries and Data Sets You can navigate the active libraries via the explorer tab or toolbar icon.
Libraries and Data Sets Folder icons represent catalogs (more on those later). Spreadsheet icons represent data sets double clicking opens a table view.
Libraries and Data Sets Columns/Variables can have both names and labels. Here the labels are shown.
Libraries and Data Sets Variables are what you refer to in various statements in your code.
Libraries and Library Assignments A SAS data library is a directory on your computer where SAS data sets are stored or will be stored. A library reference name (libref) can be assigned using the libname statement: libname libref path-specification ; The libref must be 8 characters or less; contain only letters, numbers or underscores and begin with a letter.
Libraries and Library Assignments Some data sets are posted on seashare. A potential library assignment to this folder: libname mysas '\\seashare\blumj\sas Programming Data'; Since this folder allows you only read access, your library privileges are the same.
Assigning Your Own Library Submitting this line
Assigning Your Own Library should produce a successful note in the log
Assigning Your Own Library and allow you to navigate it in the explorer. Open the projects data set.
Labels Are Not Required Here, nothing changes if you switch between names and labels for the variables.
Labels Are Not Required If labels are not assigned, the variable names are the labels.
A few other things Comments can be created in two ways: Starts with * and ends with ; *comment text; Starts with /* and ends with */ /*comment text*/ The editor uses color coding: Bright blue: Commands and options Purple: Quoted text This color: Numbers and formats Red: Bad (usually)