SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Understanding DATA Step Processing
Compilation Phase


As the INPUT statement is compiled, a slot is added to the program data vector for each variable in the input data set. Generally, variable attributes such as length and type are determined the first time that a variable is encountered.

     data perm.update;
        infile invent;
        input Item $ 1-13 IDnum $ 15-19
              InStock 21-22 BackOrd 24-25;
        Total=instock+backord;
     run;

Variables added to PDV

Missing numeric values are represented by a period and missing character values are represented by a blank.

Any variables created in the DATA step are also added to the program data vector. For example, the assignment statement below creates the variable Total. As the statement is compiled, the variable is added to the program data vector. The attributes of Total are determined by the expression in the statement. Because the expression produces a numeric value, Total is defined as a numeric variable and assigned a default length of 8.

     data perm.update;
        infile invent;
        input Item $ 1-13 IDnum $ 15-19
              InStock 21-22 BackOrd 24-25;
        Total=instock+backord;
     run;

Variables added to PDV

At the bottom of the DATA step (in this example, when the RUN statement is encountered), the compilation phase is complete and the descriptor portion of the new SAS data set is created. The descriptor portion of the data set includes:
  • name of the data set
  • number of observations and variables
  • names and attributes of the variables.

Data Set Descriptor
Data Set Name: PERM.UPDATE
Member Type: DATA
Engine: V8
Created: 11:25 Friday, August 7, 2001
Observations: 0
Variables: 5
Indexes: 0
Observation Length: 30


At this point, the data set contains the five variables defined in the input data set and assignment statement. Remember, _N_ and _ERROR_ are not written to the data set. There are no observations because the DATA step has not yet executed. During execution, each raw data record is processed and then written to the data set as an observation.

 

Note: See the section on SAS variables in SAS Language Reference: Concepts for additional information on assigning attributes to variables.

 


back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement