SAS – Your First SAS Program

SAS Program –

A SAS program is a sequence of statements executed in order. A statement gives information or instructions to SAS and must be appropriately placed in the program.

There are few rules we need to follow when writing SAS programs. Every SAS statement ends with a semicolon.

  • SAS statements can be in upper- or lowercase.
  • Statements can continue on the next line (as long as you don’t split words in two).
  • Statements can be on the same line as other statements.
  • Statements can start in any column.

Like any other language you can use Comments in SAS program. We will have another detailed post for SAS comments.

Sample Program :- 

Let’s say you want to read a file which have which have information about employee salary.
DATA EMP;
INFILE ’c:\MyRawData\Employee.dat’;
INPUT EMPID NAME $ GENDER $ SALARY;

RUN;

PROC PRINT DATA=EMP; RUN;

 

Leave a Reply

Your email address will not be published. Required fields are marked *