Build reports by using ODS to create HTML, PDF, RTF, Excel, text reports and more!

Call define in proc report

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

Call define in proc report

Hi Guys,

 

here i am using prdsale data set. I am trying to color the quarter column on basis of their number. Ex 1=pink 2=yellow 3=green 4=red.

below is my code but it is not working.

 

proc report data=sashelp.prdsale;
column product quarter;
/*define quarter/ group;*/
COMPUTE quarter;
IF quarter >3
THEN CALL DEFINE(_col_, "style", "STYLE=[BACKGROUND=RED]");
ENDCOMP;
run;


Accepted Solutions
Solution
‎05-06-2018 12:17 AM
SAS Super FREQ
Posts: 9,436

Re: Call define in proc report

[ Edited ]

Hi:

  You can also accomplish what you want to do with a format, no CALL DEFINE needed.

Cynthia

 

proc format;
  value qfmt 1='pink'
             2='yellow'
             3='green'
             4='red';
run;
  
proc report data=sashelp.prdsale;
column product quarter;
define quarter /
       style(column)={background=qfmt.};
run;

View solution in original post


All Replies
Super User
Posts: 10,860

Re: Call define in proc report

By default, numeric variable is ANALYSIS usage, therefore refer to it by xxx.sum .

 

proc report data=sashelp.prdsale nowd;
column product quarter ;
/*define quarter/ group;*/
COMPUTE quarter;
IF quarter.sum >3
THEN CALL DEFINE(_col_, "style", "STYLE=[BACKGROUND=RED]");
ENDCOMP;
run;
New Contributor
Posts: 3

Re: Call define in proc report

Thanks Ksharp

Solution
‎05-06-2018 12:17 AM
SAS Super FREQ
Posts: 9,436

Re: Call define in proc report

[ Edited ]

Hi:

  You can also accomplish what you want to do with a format, no CALL DEFINE needed.

Cynthia

 

proc format;
  value qfmt 1='pink'
             2='yellow'
             3='green'
             4='red';
run;
  
proc report data=sashelp.prdsale;
column product quarter;
define quarter /
       style(column)={background=qfmt.};
run;
New Contributor
Posts: 3

Re: Call define in proc report

Posted in reply to Cynthia_sas
Thanks Cynthia
☑ This topic is solved.

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

Discussion stats
  • 4 replies
  • 406 views
  • 2 likes
  • 3 in conversation