SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Understanding DATA Step Processing
Compilation Phase


In this lesson, you work with a DATA step that reads raw data from an external file (which is referenced by the fileref Invent) and that creates a SAS data set named Perm.Update.
     data perm.update;
        infile invent;
        input Item $ 1-13 IDnum $ 15-19
              InStock 21-22 BackOrd 24-25;
        Total=instock+backord;
     run;

Raw Data File Invent
1---+----10---+----20---+-
Bird Feeder   LG088  3 20 
6 Glass Mugs  SB082  6 12 
Glass Tray    BQ049 12  6 
Padded Hangrs MN256 15 20 
Jewelry Box   AJ498 23  0 
Red Apron     AQ072  9 12 
Crystal Vase  AQ672 27  0 
Picnic Basket LS930 21  0 
Brass Clock   AN910  2 10 


How SAS Software Processes Programs

When you submit a DATA step, SAS software processes the DATA step and creates a new SAS data set. Let's see exactly how that happens.

A SAS DATA step is processed in two distinct phases:


Descriptor and Data Portions of Data Set

  • During the compilation phase, each statement is scanned for syntax errors. Most syntax errors prevent further processing of the DATA step.

  • If the DATA step compiles successfully, then the execution phase begins. A DATA step executes once for each observation in the input data set, unless otherwise directed.

First, let's look at the compilation phase.


back||next


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

Terms of Use & Legal Information | Privacy Statement