May 26, 2021 SAS
Like any other programming language, the SAS language has its own syntax rules to create SAS programs. T he three components of any SAS scenario - declarations, variables, and datasets - follow the following syntax rules.
The variables in the SAS represent a column in the SAS dataset. T he variable name follows the following rules.
# Valid Variable Names REVENUE_YEAR MaxVal _Length # Invalid variable Names Miles Per Liter #contains Space. RainfFall% # contains special character other than underscore. 90_high # Starts with a number.
The DATA statement tag creates a new SAS dataset.
The rules for creating a DATA set are as follows.
# Temporary data sets. DATA TempData; DATA abc; DATA newdat; # Permanent data sets. DATA LIBRARY1.DATA1 DATA MYLIB.newdat;
The results of SAS programs, data files, and programs are saved in Windows with various extensions.
Comments in SAS code are specified in two ways. T he following are the two formats.
Comments in the form of messages; Y ou cannot include a sign or mismatched quotation marks in it. A dditionally, there should be no reference to any macro statements in such comments. I t can span multiple lines and can be of any length: H ere's an example of a one-line comment:
* This is comment ;
Here's an example of a multi-line comment:
* This is first line of the comment * This is second line of the comment;
Comments in the form of / messages are used more frequently and cannot be nested. B ut it can span multiple lines and can be any length. H ere's an example of a one-line review:
/* This is comment */
Here's an example of a multi-line comment:
/* This is first line of the comment * This is second line of the comment */