Hi:
I'm not actually sure what you want. The variables in the PDV (program data vector) are all the variables which are "available" for use in the program. Consider this program:
[pre]
data new;
set sashelp.class;
age_in_5 = age + 5;
weight_in_5 = weight + 15;
run;
[/pre]
In this program, the PDV has these variables:
_N_ _ERROR_ NAME SEX AGE HEIGHT WEIGHT AGE_IN_5 and WEIGHT_IN_5
The only variables -used- in the program are AGE and WEIGHT, (SAS uses _N_ and _ERROR_ -- but you generally don't worry about those) but the program also creates AGE_IN_5 and WEIGHT_IN_5 -- do they count -- is being CREATED the same as being USED?
Even though you didn't "technically" use NAME, would the new file, WORK.NEW be meaningful without NAME??? Probably not...but it depends on what you're doing with WORK.NEW. Maybe you need a copy of the original dataset, including NAME, SEX, HEIGHT, AGE, WEIGHT, AGE_IN_5 and WEIGHT_IN_5 -- maybe not. Possibly a more useful way to code the above program might be:
[pre]
data new(keep=name age weight age_in_5 weight_in_5);
set sashelp.class(keep=name age weight);
age_in_5 = age + 5;
weight_in_5 = weight + 15;
run;
[/pre]
In my mind, the issue is not so much which variables are being used, per se, as which variables are needed after the program is over. For example, if you have a dataset of 500 variables -- you might need to go in and fix a zip code on some of the observations. In this instance, so what if zip code was the only variable techically "used"?? If all subsequent processes depend on there being 500 variables in the data set, in a standard input/output chart, I'd show 500 variables going into the program, show 1 variable being changed based on some condition and then show 500 variables coming out of the program.
Honestly, I don't understand the need for this distinction (between the variables in the dataset and the variables "used" in the program).
cynthia