BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bharath86
Obsidian | Level 7
%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. 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star
Take a look at the global option DKRICOND=

View solution in original post

2 REPLIES 2
Astounding
PROC Star
Take a look at the global option DKRICOND=
bharath86
Obsidian | Level 7
Excellent, learned something new today.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1093 views
  • 0 likes
  • 2 in conversation