BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SasStatistics
Pyrite | Level 9

I have created a macro to replace a script. In order to check that the tables produced by the macro / script respectively are identical (with proc compare), I would need the capability to change all the names in the work library by for instance adding a letter. 

Example: 

Running the script yields: 
Table1 [Would like to change this table name to:] Table1_A

Table2 [Would like to change this table name to:] Table2_A

Running the Macro yields: 

Table1 

Table2  

Since I changed the names the two tables won't be overwritten and I can use proc compare without trouble. 

In the real example, my script produces like 15 tables so would be nice with a "Automatic" solution. 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Why make life this difficult?  Use PROC COPY to copy the existing tables to a different library.  When you use PROC COMPARE, you can compare a table in the WORK library with a table of the same name in your "different" library.  If you so choose, delete the "different" library when you are done.

 

If it's easier, the new tables can go into the "different" library instead, just by adding two lines to your program and without changing the macro.  What's your pleasure?

View solution in original post

3 REPLIES 3
Astounding
PROC Star

Why make life this difficult?  Use PROC COPY to copy the existing tables to a different library.  When you use PROC COMPARE, you can compare a table in the WORK library with a table of the same name in your "different" library.  If you so choose, delete the "different" library when you are done.

 

If it's easier, the new tables can go into the "different" library instead, just by adding two lines to your program and without changing the macro.  What's your pleasure?

tarheel13
Rhodochrosite | Level 12

I was going to suggest this too. I make TLFs for a large CRO and we use proc compare. We just save the QC tables in another directory separate from the production side.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 3 replies
  • 902 views
  • 7 likes
  • 3 in conversation