SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Understanding DATA Step Processing
Execution Phase


Next, control returns to the top of the DATA step. Then the variable values in the program data vector are reset to missing. Notice that the automatic variables retain their values.
     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
V---+----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 


Control Returns to Top of DATA Step


SAS Data Set Perm.Update
Item IDnum InStock BackOrd Total
Bird Feeder LG088 3 20 23


Note: When reading raw data, SAS software sets the value of each variable in the DATA step to missing at the beginning of each iteration, with these exceptions:
  • variables named in a RETAIN statement
  • variables created in a sum statement
  • data elements in a _TEMPORARY_ array
  • any variables created with options in the FILE or INFILE statements
  • automatic variables.

In contrast, when reading a SAS data set, SAS software sets the values to missing only before the first iteration of the DATA step. Thereafter, the variables retain their values until new values become available, for example, through an assignment statement or through the next execution of a SET or MERGE statement. Variables created with options in the SET or MERGE statements also retain their values from one iteration to the next.



back||next


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

Terms of Use & Legal Information | Privacy Statement