SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Understanding DATA Step Processing
Execution Phase


The execution phase continues in this manner until there are no more records in the raw data file to be read.

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 


SAS Data Set Perm.Update
Item IDnum InStock BackOrd Total
Bird Feeder LG088 3 20 23
6 Glass Mugs SB082 6 12 18
Glass Tray BQ049 12 6 18
Padded Hangrs MN256 15 20 35
Jewelry Box AJ498 23 0 23
Red Apron AQ072 9 12 21
Crystal Vase AQ672 27 0 27
Picnic Basket LS930 21 0 21
Brass Clock AN910 2 10 12


Remember, the order in which variables are defined in the DATA step determines the order in which the variables are stored in the data set. The DATA step below, which reverses the order of Item and IDnum, would produce a different data set from the same raw data.
     data perm.update;
        infile invent;
        input IDnum $ 15-19 Item $ 1-13 <-- reversed
              InStock 21-22 BackOrd 24-25;
        Total=instock+backord;
     run;

SAS Data Set Perm.Update
Item IDnum InStock BackOrd Total
Bird Feeder LG088 3 20 23
6 Glass Mugs SB082 6 12 18
Glass Tray BQ049 12 6 18
Padded Hangrs MN256 15 20 35
Jewelry Box AJ498 23 0 23
Red Apron AQ072 9 12 21
Crystal Vase AQ672 27 0 27
Picnic Basket LS930 21 0 21
Brass Clock AN910 2 10 12
   ^--reversed--^


back||next


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

Terms of Use & Legal Information | Privacy Statement