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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.