SAS Enterprise Guide

Desktop productivity for business analysts and programmers
BookmarkSubscribeRSS Feed
amar8580
Calcite | Level 5

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

2 REPLIES 2
TomKari
Onyx | Level 15

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

 

Ksharp
Super User

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;

undefined

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 2 replies
  • 1256 views
  • 0 likes
  • 3 in conversation