SAS studio basically consists of 4 windows as follows:
- Explorer Window or Navigation Pane
- Editor Window or Code Window
- Log Window
- Result Window or Output Data Window.
SAS program is divided into two steps
a. Data step
b. PROC step
DATA step consists group of statements which begins with keyword DATA and ends with RUN. The entire statements of the program are given between DATA and RUN. Each statement should end with semicolon
proc step starts with keyword Proc and ends either with run or quit.
PROC PRINT is used to display the entire table or selected columns in result window.
VAR statement can be used to select the desired columns to be displayed and also to change the order of variables displayed in the result window.
Data is basically is of two types
- Structured Data: This data is having a particular structure that means already arranged in the form of rows and columns with a metadata. Eg. SAS tables.
- Unstructured Data: Here the data is not properly arranged into rows or columns.
Raw Data: Data which is untouched or not modified or manipulated is called raw data.
Raw data can be accessed in two ways
a. Instream Data: Here the data is read from the program itself using INPUT statement and DATALINES or CARDS.
b. External File: Here the data is read from external files like text, Excel, CSV, Database file formats using INFILE or PROC IMPORT
Instream data:
INPUT statement is used to define the metadata of the variables. Character variables are defined by using dollar sign after the name of the variable whereas numeric variables are simply defined without dollar sign.
DATALINES or CARDS is used to assign the data for the variables already defined in INPUT statements. The order of data values should follow the same order in which they are defined in INPUT statement.
The default delimiter used for separating the variables and values is SPACE. The keywords are displayed in blue color differentiating from normal text. semicolon should not be used in between the data values and should be used at the end when values of all the rows of the table are successfully assigned in DATALINES.
For running the program the text which is desired to be executed should be selected first, followed by clicking RUN option displayed in top menu of editor window.