x cd /mscdc/sascode/stf3prca.sascode; %let pgm=testdrive; filename pgm "&pgm..sas"; %libname(stf903); *--define the stf903 libref--; libname stf903wc '/mscdc/data/stf903/wcs.bystate' access=readonly; OPTIONS MSGLEVEL=I; %global title profiles setin where; %LET SETIN=STF903.mostcnty; %let where= %str( where msacmsa ne ' ' and p1i1 gt 100000; ); %let setin=stf903wc.rsabyst; %let where=%str( where state='19' and ruraltco in ('R ','NR'); ) ; %LET TITLE=California Profiles for Rural and Non-Rural Service Areas of States; %LET PROFILES=%str(1-29); *--this tricky bit of code attempts to get around the maddening requirement that the sas dataset referenced in the redirect input clause must have **exactly** the same variables as on the set used to compile the program. So we reference the stf903.usother set here without actually reading any obs. Then we use a keep to keep only those vars that are on that model set. The app will not be able to access any vars on your input set that are not on the model. That should be OK. --; data inview/view=inview; if 0 then set stf903.usother; set &setin ; *<---the real dataset; &where ; keep recno--geogroup; run; DATA PGM=library.stf3prca; REDIRECT INPUT stf903.usother=inview; RUN;