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.
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?
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?
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.
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!
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.