Hi everyone,
I'm using SAS EG 9.4 and currently trying out the proc ds2. What I am trying to do is to use the value from a variable as a table name in the set statement and not specifying the table name explicitly.
proc ds2;
data differences (overwrite=yes);
dcl double count_diff;
method compareTables(char(255) inBaseTable, char(255) inCompareTable);
set {select * from (select * from inBaseTable) as base_data
except
select * from (select * from inCompareTable) as compare_data};
end;
The table names are passed to the method compareTables, when the codes is being compiled and executed the following error message is being thrown. Apparently the variable contatining the table name is not resolved.
How can I use a variable instead of table name in the sql set statement?
Thanks
I don't know what you can and cannot do in SET statement for PROC DS2.
But an easy way out is to store the result of your query in a macro variable instead, prior to the PROC DS2 program.
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.