From: Catima Potter on
Hello,

I am writing code where I need to see if a variable exists in the
dataset. If it is not there, then I would like to include it with a
value of . (missing). I have tried this code but when the variable does
exists, it is overwriting the values to missing. Your assistance is
greatly appreciated. ~Catima


data have;
input _20093 _20094 rate $;
cards;
3 1 staffing
5 2 staffing
7 3 staffing
9 4 staffing
11 5 staffing
13 6 staffing
15 7 staffing
17 8 staffing
19 9 staffing
;

%let pastyrqtr = _20093;
data have;
set have;
if symexist('&pastyrqtr') then put '**** &pastyrqtr exists';
else &pastyrqtr = .;
run;