Looking for some help on this error. Code which I've is similar to below
%macro temp_data( out_sales_tbl= ) / minoperator; data WORK.&out_sales_tbl._hdp ; .... run; %mend;
and we are calling the above macro as below. Value for this macro variable (out_sales_tbl) will be resolved by other macro.
%temp_data ( out_sales_tbl=%quote(&out_sales_tbl) );
Error which I got is,
SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing. SYMBOLGEN: Macro variable OUT_SALES_TBL resolves to out_sales_table SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing. NOTE: Line generated by the macro variable "OUT_SALES_TBL". 211 WORK.out_sales_table_hdp ---- 22 ---- 202
Do you have logic in trhe macro that affects the value of said macro variable?
Otherwise, why do you need to resolve it within the macro?
I guess I need to see the full code to be able to give you an appropriate advice.
Try this:
%macro temp_data(
out_sales_tbl=
) / minoperator;
data WORK.%unquote(&out_sales_tbl._hdp) ;
....
run;
%mend;
Good macroquoting reading:
"Secrets of Macro Quoting Functions – How and Why" by Susan O’Connor
Bart
@yabwon still the same error
My bad, try this:
%unquote(WORK.&out_sales_tbl._hdp)
Bart
@yabwon still the same error
Show the log.
@Babloo wrote:
@yabwon still the same error
Please give us information that we can work from. Show us the entire LOG for this code you are working with (not just the ERROR messages). Also please show us the entire CODE, including the part where the macro variable is assigned a value. Also, please answer @Kurt_Bremser's question.
Can you show the log from running @yabwon's original suggestion, I think it should work.
But more importantly, please make a small example of this problem, and post the code and the log you get.
From what I can see in the log you've shared, you've got code like:
%let out_sales_tbl=out_sales_table ;
%macro temp_data(out_sales_tbl=);
%put _local_ ;
data WORK.&out_sales_tbl._hdp ;
run;
%mend;
%temp_data(out_sales_tbl=%quote(&out_sales_tbl))
As others have pointed to the macro quoting is not needed. Also note the &out_sales_tbl is resolved during the call to temp_data. If you want to delay that, you would need to use %nrstr(). The quoting characters introduced by %quote() cause problems for the compiler, but @yabwon's %unquote suggestion resolves them for my test:
%let out_sales_tbl=out_sales_table ;
%macro temp_data(out_sales_tbl=);
%put _local_ ;
data WORK.%unquote(&out_sales_tbl._hdp) ;
run;
%mend;
%temp_data(out_sales_tbl=%quote(&out_sales_tbl))
Why do you think you need a macro quoting function around a simple dataset name?
The simple solution is to fix the CALL to the macro.
A valid dataset name cannot contain any character that needs macro quoting so don't quote it.
Plus you are just confusing yourself by calling the macro with the value of a macro variable that has the same name as the macro variable used as the parameter name.
%let some_other_mvar = table_name;
%temp_data(out_sales_tbl=&some_other_mvar);
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.