Sas PPT 1
Sas PPT 1
Programming
Some notes pulled from SAS
Programming I: Essentials Training
SAS Datasets
Examining the structure of SAS
Datasets
SAS Data Sets
Two Sections
Descriptor Section
Data Section
Data Set Descriptor Section
SAS Data Section
Attributes of Variables
● Name
● e.g. Status
● Type
● Numeric or Character
● e.g. Status in this example is character (T, TT, PT,
or NTT) and Satisfaction is numeric (1 to 5).
SAS Data Set Terminology
Using the free-format Syntax rules of SAS though can make it difficult for others
(or you) to read your program. This is akin to writing a page of text with little
attention to line breaks. You may still have capital letters and periods, but where a
sentence begins and ends may be a bit confusing. Isn’t this paragraph a bit
easier to read?
SAS Comments
● Type /* to begin a comment.
● Type your comment text.
● Type */ to end the comment.
● Or, type an * at the beginning of a line. Everything
between the * and the ; will be commented.
● e.g. *infile ‘tutor.dat’;
● Alternatively, highlight the text that you would like to
comment and use the keys Ctrl / to comment the
line. To uncomment a line, highlight and use the Ctrl
Shift / keys.
SAS Comments
SAS Windows
SAS Windows
Explorer Log
Editor
Enhanced Editor Window
Output
Enhanced
Editor
● SAS Log provides a “blow by blow” account of the execution of your program. It
includes how many observations were read and output, as well as, errors and notes.
● Note the errors in red.
Output Window
SAS Library
● SAS Data Libraries are like drawers in a filing cabinet. The SAS data sets are files
within those drawers. Note the icons for the SAS library match that metaphor.
● In order to assign a “drawer”, you assign a library reference name (libref).
● There are two drawers already in your library: work (temporary) and sasuser
(permanent).
● You can also create your own libraries (drawers) using the libname statement.
Establishing the libname