Hi,
I am reading through the SAS Specialist Guide book and I am a bit confused about whether or not SAS resets the values in the PDV for each new iteration:
Earlier in the book, it says the variable values in the PDV are reset to missing for each iteration.
Sample code used in book:
data work.update;
set cert.invent;
Total=instock+backord;
SalePrice=(CostPerUnit*0.65)+CostPerUnit;
format CostPerUnit SalePrice dollar6.2;
run;
The variables InStock BackOrd CostPerUnit Total SalePrice are shown in a table with initialized missing values in the book for each starting iteration.
Then the NEXT section in the book has:
When PROC IMPORT reads raw data, SAS sets the value of each variable in the DATA step to missing at the beginning of each cycle of execution, with these exceptions:
variables that are named in a RETAIN statement
variables that are created in a sum statement
automatic variables
In contrast, when reading variables from a SAS data set, SAS sets the values to missing only before the first cycle of execution of the DATA step. Therefore, 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 that are created with options in a SET or MERGE statement also retain their values from one cycle of execution to the next.
My questions:
1. In the NEXT section, is it referring to situation for PROC IMPORT? If so, why would you use a PROC IMPORT on a SAS data set? If not, then it contradicts to earlier section in the book.
2. From the book, Variables that are created with options in a SET or MERGE statement, what variables can you create with options other than the in= variables?
3. Can I use the PUTLOG before and after the SET statement to test whether the variables are initialized to missing? Unfortunately for me, I don't have access to SAS. Is there a student version anywhere for people learning SAS?
Thanks!
... View more