Module 6: More Advanced Data Handling Flashcards
T/F: Automatic variables are temperaray
True
How does SAS identify the beginning and end of the temporary variables?
When a dataset is sorted, SAS identifies it by the By group and creates first. and last. temporary variables.
What are the four different combinations of first and last variables and what do they represent?
1) first = 1 last = 0, identifies first variable
2) first=0 last=1, identifies the last variable
3) first=0 last=0, identifies neither first or last (middle)
4) first=1 last=1, identifies first and last observation (only 1 variable)
T/F: You do not need to create permanent variables to reference automatic variables outside of the first data step.
False: You do. Automatic variables can only be accessed in the dataset they are created unless assigned to a permanent variable.
What happens to automatic variables when data is sorted by multiple variables?
Automatic variables are created for each sorted variable. The second variable automatics account for first and last values for each of the first sorted value.
What are the automatic variables N and Error?
N: the number of times SAS has looped through the DATA step
Error: equal to 1 if there is a data error for an observation and otherwise zero
T/F: N always equals the observation number
False: If there is a subsetting statemenet, a Merge statement, etc then the observation number and the number of iterations of the DATA step are not the same.
What does the Retain statement do?
It keeps the value of the variable of interest unchanged in the PDV from one observation to the next.
Also creates a variable it if does not exist
Fill in the blank:
The retain statement has no effect on varaibles read in with ___ and ___ statements.
Set and Merge