BookmarkSubscribeRSS Feed
shc1212
Calcite | Level 5

Hi,

 

I was wondering if there is a way to replace the Base and Compare values in the proc compare output, to enable easier review. Example - Base is replaced as QC, Compare is replaced as  Production. 

 

Thanks

 

5 REPLIES 5
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

something like this

 

%let mybase = thisone;
%let mycomp = thatone;

proc compare base=&mybase. compare=&mycomp.;
run;

if you are comparing to a production dataset the base should be assigned to the production table as a good rule of thumb.

 

shc1212
Calcite | Level 5

that wont work.  see the output below. 

What I want is to replace that Base and Compare by QC and Production.

 

|| Planned Treatment for Period 01 (N)
|| Base Compare
USUBJID || TRT01PN TRT01PN Diff. % Diff
_________________ || _________ _________ _________ _________

Reeza
Super User

@shc1212 wrote:

that wont work.  see the output below. 

What I want is to replace that Base and Compare by QC and Production.

 

|| Planned Treatment for Period 01 (N)
|| Base Compare
USUBJID || TRT01PN TRT01PN Diff. % Diff
_________________ || _________ _________ _________ _________


 

Not easily, you could by modifying the template for the procedure but I highly suspect that's more work that it's worth. Instead, I would try to pipe the results to a data set, customize the names within the data set and then use PROC PRINT/REPORT to display the output.

Reeza
Super User

You can create a small macro that does this easily.

 

%macro customCompare(source = , compare = );

proc compare base=&source. compare = &compare <other options as needed>;
....

run;

%mend customCompare;

And then you can call it each time as:

 

%customCompare(base = QC, compare=Production);

%customCompare(base = QC1, compare=Production2);

@shc1212 wrote:

Hi,

 

I was wondering if there is a way to replace the Base and Compare values in the proc compare output, to enable easier review. Example - Base is replaced as QC, Compare is replaced as  Production. 

 

Thanks

 


 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 573 views
  • 0 likes
  • 3 in conversation