Hi ,
When i use macro variables inside the sql i can see the values in log if i use symbol gen
Isn't there a way to see it in the SQL? like expected output below ?
input :
%macro dothis;
%let test=abc;
%let test2=xyz;
data ds;
x=1;
y=2;
run;
proc sql;
create table &test._&test2. as select * from ds;
quit;
%mend;
options mprint;
%dothis
Thank you !!
Does that work if we eliminate the macro as well?
It is not working if we remove %macro ,could you please let me know if we have any other option ?
If you want to see the value in the log use the %PUT statement.
%put &=test &=test2 ;
proc sql;
create table &test._&test2. as
select *
from ds;
quit;
Note: In this case you don't really need to see the value of the macro variables because the NOTE in the SAS log about the dataset being created will include the name of the dataset.
@mmkr wrote:
It is not working if we remove %macro ,could you please let me know if we have any other option ?
No other option that I know of. Why would having working code inside a macro be a problem that has to be avoided with some other solution?
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.