The macro variabe &&var&i. resolves to Bank, credit etc etc.
There are attribute macros like %attrib_bank,%attrib_credit etc
I would like to the correct attribute based on the dataset name
Now is there a way how to append the &&var&i to %attrib_ so the correct attribute is passed based on &&var&i?
Example:
For i=1
&&var&i. resolves to Bank
data test_bank;
%attrib_??;-----The challenge is here, to execute %attrib_bank
run;
%attrib_&&var&i. -> that doesn't work?
@SASPhile wrote:
The macro variabe &&var&i. resolves to Bank, credit etc etc.
There are attribute macros like %attrib_bank,%attrib_credit etc
I would like to the correct attribute based on the dataset name
Now is there a way how to append the &&var&i to %attrib_ so the correct attribute is passed based on &&var&i?
Example:
For i=1
&&var&i. resolves to Bank
data test_bank;
%attrib_??;-----The challenge is here, to execute %attrib_bank
run;
Works fine for me.
%let i=1 ;
%let var1=bank;
%macro attrib_bank;
* part of a data step ;
%mend attrib_bank;
options mprint;
data test_bank;
%attrib_&&var&i;
run;
17 data test_bank; 18 %attrib_&&var&i; MPRINT(ATTRIB_BANK): * part of a data step ; 19 run; NOTE: The data set WORK.TEST_BANK has 1 observations and 0 variables.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.