@HeatherNewton wrote:
oh assuming all the macro variable are setup correctly etc
does infile statement allows macro variable being inside quotation mark?
The SAS language allows macro variables to be resolved inside double quotation marks. To test it out, you can use the %PUT statement, e.g.:
%let yyyymmdd=20231130 ;
%put "/boccc/miu/interface/monthly.pd_pool_id_&yyyymmdd_L6.";
You will see that that code does not work you get:
1 %let yyyymmdd=20231130 ;
2 %put "/boccc/miu/interface/monthly.pd_pool_id_&yyyymmdd_L6.";
WARNING: Apparent symbolic reference YYYYMMDD_L6 not resolved.
"/boccc/miu/interface/monthly.pd_pool_id_&yyyymmdd_L6."
So SAS looked for a macro variable named YYYYMMDD_L6, which does not exist. The answer here is to add a dot after the name of the macro variable, to tell the macro processor that the name of the macro variable has ended.
If you add a dot, the log will show that the code works:
5 %let yyyymmdd=20231130 ;
6 %put "/boccc/miu/interface/monthly.pd_pool_id_&yyyymmdd._L6.";
"/boccc/miu/interface/monthly.pd_pool_id_20231130_L6."
You don't have to worry about any special rules relating to the INPUT statement, or any other SAS statement when you want to use a macro variable. SAS statements do not have any interaction with the macro language. The macro language is generating SAS code. So for examples like this, it's helpful to test your macro code with a simple %PUT statement, which will allow you to see the code generated by the macro language. If that code looks good, then you can use it anywhere. So you can be confident that you could do:
infile "/boccc/miu/interface/monthly.pd_pool_id_&yyyymmdd._L6.";
or
title "Data for monthly.pd_pool_id_&yyyymmdd._L6.";
or
data want ;
date=input("&yyyymmdd",yymmdd8.) ;
format date date9. ;
put date= ;
run ;
... View more