Desktop productivity for business analysts and programmers

sas proc report

Reply
Occasional Contributor
Posts: 9

sas proc report

hi all 

i am new to sas and using SAS EG

i am trying to do two things using proc report

my data is following

h1 | rgu

sales | 700

wow | .5

what i want to do is format alignment of h1 column that if value is sales then align to right, if value is wow then align h1 column to left.

also i am able to change the wow rgu value to percent but how do i color it to red if negative and green if positive.

any suggestions would help

PROC Star
Posts: 1,146

Re: sas proc report

Hi, and welcome to the SAS community!

 

PROC REPORT is an amazing tool, but to be honest it's a challenge for new users. I've just climbed that learning curve because of a new project.

 

I'm pretty sure what you want can be fairly easily done using PROC REPORT, and probably not with anything else, but I don't have the time to go through the trial-and-error to figure it out.

 

I'm pretty sure you'll want to use the STYLE features in PROC REPORT. I can suggest two things:

 

This link show an example of using PROC REPORT to change style elements; in particular, check out the "compute sales" block, where the characteristics of data are used to change the style of the cell.

 

http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a000545547.htm

 

 The other thing I do is google furiously for the result I'm trying to get. There are some amazing papers out there where PROC REPORT experts show how to accomplish these tasks.

 

One last comment; I'm fairly sure you won't be able to get your result using the "List Report" task, you'll most likely have to write SAS code to do this.

 

Good luck!

   Tom

 

Super User
Posts: 9,865

Re: sas proc report

You should post it at ODS and Base Reporting

 

 

data have;
input h1 $ rgu;
cards;
sales   700
wow   .5
wwe   -.5
;
run;

proc format;
value fmt
 low-<0='red'
 0-high='green';
run;



proc report data=have nowd;
columns h1 rgu;
define h1/display style={cellwidth=40};
define rgu/display style={backgroundcolor=fmt.};
compute h1;
 if h1='sales' then call define(_col_,'style','style={just=right}');
endcomp;
run;

x.png

Ask a Question
Discussion stats
  • 2 replies
  • 254 views
  • 0 likes
  • 3 in conversation