%let lpremig=;
%let lpostmig=;
libname premig "&lpremig";
libname postmig "&lpostmig";
option nodate pageno=1 linesize=80 pagesize=40;
%macro Compds (dsview);
Proc sort data=premig.&dsview out= &dsview.pre;
By id;
Run;
Proc sort data=postmig.&dsview out=&dsview.post;
By id;
Run;
Proc compare base=&dsview.pre compare=&dsview.post (drop=a b c d e f g) ;
run;
%mend compds;
%compds(A);
%compds(B);
I am trying to eliminate a few variables from a comparison in the above macro, however, the variables in the drop statement are not available in all datasets.
If need to run both A and B reports together and eliminate a few variables without an
ERROR: The variable b c in the DROP, KEEP, or RENAME list has never been
referenced.
I dont want to change the variable names every now and then since I know I have a set of variables to be eliminated from few datasets.
I need a single report with all datasets comparison by eliminating the set of variables where ever applicable.
Please advise, how to achieve this.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.