Help using Base SAS procedures

PROC REPORT and Masking

Accepted Solution Solved
Reply
Contributor
Posts: 29
Accepted Solution

PROC REPORT and Masking

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!


Accepted Solutions
Solution
‎10-21-2016 10:42 AM
Super User
Super User
Posts: 7,039

Re: PROC REPORT and Masking

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


All Replies
Super User
Super User
Posts: 7,942

Re: PROC REPORT and Masking

[ Edited ]

At a guess, just put single quotes around it:

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

Contributor
Posts: 29

Re: PROC REPORT and Masking

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.
Solution
‎10-21-2016 10:42 AM
Super User
Super User
Posts: 7,039

Re: PROC REPORT and Masking

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)));
Respected Advisor
Posts: 3,799

Re: PROC REPORT and Masking

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

 

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

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