Hi.
Yes, DICTIONARY.COLUMNS or PROC CONTENTS with output to a dataset.
Next, you just need to load some macro variables with the input of the DICTIONARY.COLUMS/output from PROC CONTENTS and sufix them with _NEW / _OLD.
For examples:
proc contents data = WORK.INFILE out = WORK._CONTENTS noprint;
run;
* cats is just use for text trimming;
data _null_;
set WORK._CONTENTS end = _EOF; /* _EOF = 1 when end of file */
/* create VARX_NEW and VARX_OLD macro vars */
/* _N_ is the current observation number, NAME is the variable name */
call symput(cats('VAR',put(_N_,best.),'_NEW'),cats(NAME,'_NEW'));
call symput(cats('VAR',put(_N_,best.),'_OLD'),cats(NAME,'_OLD'));
/* if end of file store VAR_COUNT as total number of variables */
if _EOF then call symput('VAR_COUNT',cats(put(_N_,best.)));
run;
then you will be able to use in your code:
&VAR1_NEW
&VAR1_OLD
...
being &VAR_COUNT the total variable count.
Hope it helps.
Greetings from Portugal.
Daniel Santos at
www.cgd.pt