Maybe it would help to make physical model you can try yourself.
Take a deck of playing cards and divide it into four stacks by SUIT. So you have a CLUB, DIAMOND, HEART and SPADE stack. That is your input dataset HAVE with four variables.
Now run this program.
data want;
set have;
drop club ;
run;
So first you pick up one card from each stack and put them into your hand. The hand represents the variables that are active while the data step is running (also called the Program Data Vector or the PDV). Next place the DIAMOND, HEART and SPACE cards into three new stacks that will represent the WANT dataset. You will have to discard the CLUB card since that variable is being dropped so there is no stack to place it into. Repeat until you run out of cards in the original four stacks.
How would you modify this example to simulate the effect of a DROP= dataset option on the input dataset? How would you modify this example to simulate the effect of a DROP= dataset option on the output dataset?
If you want to get tricky how would you modify it to represent the RENAME statement or the RENAME= dataset option on either input or output dataset?
... View more