Module 6: More Advanced Data Handling Flashcards

1
Q

T/F: Automatic variables are temperaray

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does SAS identify the beginning and end of the temporary variables?

A

When a dataset is sorted, SAS identifies it by the By group and creates first. and last. temporary variables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the four different combinations of first and last variables and what do they represent?

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

T/F: You do not need to create permanent variables to reference automatic variables outside of the first data step.

A

False: You do. Automatic variables can only be accessed in the dataset they are created unless assigned to a permanent variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What happens to automatic variables when data is sorted by multiple variables?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the automatic variables N and Error?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

T/F: N always equals the observation number

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the Retain statement do?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Fill in the blank:

The retain statement has no effect on varaibles read in with ___ and ___ statements.

A

Set and Merge

How well did you know this?
1
Not at all
2
3
4
5
Perfectly