BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dtchoi86
Fluorite | Level 6

Hello I am having trouble masking the following highlighted in yellow:

 

proc report data=safrptshell1 nowd
...;

compute groups;
if groups='OVERALL' then
do;
groups="Criteria (%nrbquote(Dummy = "Y"))";
call define (_col_, "style/merge", "style=[font_face=&font. fontstyle=italic]");
end;
else if strip(groups) in(...) then
do;
call define (_col_, "style/merge", "style=[font_weight=bold]");
end;
endcomp;

run;

 

I get the following error "ERROR 388-185: Expecting an arithmetic operator."  It seems no matter what type of masking I try, the procedure unmasks the block of line before execution.  Is there a way to quote/mask this?

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

If you have control over the macro variable generation then it is not much of an issue.

%let group = Dummy='Y';
...
groups="Criteria (&group)";

If don't and the value of &GROUP might have double quotes then you can use QUOTE() function to make sure they are properly doubled up.

 

groups= %sysfunc(quote(Criteria (&group)));

View solution in original post

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

At a guess, just put single quotes around it:

groups='Criteria (Dummy = "Y")';

dtchoi86
Fluorite | Level 6
If I were to replace the dummy with a macro:
%let dummy = Dummy = "Y";

group = 'Criteria (&dummy)';

My guess is that this would not work? I should have been more clear - sorry. I would eventually like to put in a macro there.
Tom
Super User Tom
Super User

If you have control over the macro variable generation then it is not much of an issue.

%let group = Dummy='Y';
...
groups="Criteria (&group)";

If don't and the value of &GROUP might have double quotes then you can use QUOTE() function to make sure they are properly doubled up.

 

groups= %sysfunc(quote(Criteria (&group)));
data_null__
Jade | Level 19

QUOTE function will properly quote DUMMY to produce the correct syntax.

 

%let dummy = dummy = "y";
data class;
   length sex $32;
   set sashelp.class;
   run;
proc report data=class;
   columns sex height;
   define sex / group;
   
   compute sex;
      if sex = 'M' then do;
         sex = %sysfunc(quote(Criteria(&dummy)));
         end;
      endcomp;
   run;

Capture.PNG

 

 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1967 views
  • 4 likes
  • 4 in conversation