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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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