I am facing below error while executing below macro.
can someone please help.
%macro test (stx = );
%if &stx. ne %then %do;
data test;
test = "test quote";
run;
%end;
%mend test;
%test (stx = %str(test ()-N) );
Can you explain the larger picture? You have posted a number of questions about using macros and macro variables where macro variables have parentheses in them. It appears that you are constructing macros variables whose values have parentheses in the, and this seems inefficient and can cause lots of these types of problems, and I get the feeling there probably is a much easier way to handle this.
Your specific problem goes away with
%if %superq(stx) ne %then %do;
Can you explain the larger picture? You have posted a number of questions about using macros and macro variables where macro variables have parentheses in them. It appears that you are constructing macros variables whose values have parentheses in the, and this seems inefficient and can cause lots of these types of problems, and I get the feeling there probably is a much easier way to handle this.
Your specific problem goes away with
%if %superq(stx) ne %then %do;
Modifying my answer to the following:
%if %bquote(&stx) ne %then %do;
I guess my feeling is that you use the lowest level of quoting needed, which would be %bquote rather than %superq; however not knowing the full extent of how this cod will be used, %superq may be needed for other values of &stx
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.