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
%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
My bad, try this:
Show the log.
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 open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.