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
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.