Help using Base SAS procedures

SAS Proc format color - How to compare value and assign color to different variable in ODS

Reply
Occasional Contributor
Posts: 10

SAS Proc format color - How to compare value and assign color to different variable in ODS

Hello,

I am preparing a PROC Format and creating colors based on the values on that particular value.

Please let me know how to compare different variable and assign the colour to a variable.

PROC FORMAT;

     VALUE MY_SCRATVOl

           00001 - 00250 = RED

           00251 - 10000 = YELLOW

           10001 -  HIGH = WHITE

RUN;

PROC PRINT    DATA=POOLCNT_VCL SPLIT='*' NOOBS LABEL                

      STYLE(HEADER OBSHEADER)  = {BACKGROUNDCOLOR=GREY COLOR=WHITE   

                                  FONTWEIGHT=BOLD TEXTALIGN=CENTER } 

      STYLE(OBS DATA) = {BACKGROUNDCOLOR=WHITE COLOR=BLACK           

                                           TEXTALIGN=CENTER }        ;

      ID  COMPLIB LPAR

      VAR SCRATVOL / STYLE={FONT_WEIGHT=BOLD BACKGROUND=MY_SCRATVOL} ;

Thanks,

Sathish

Trusted Advisor
Posts: 1,137

Re: SAS Proc format color - How to compare value and assign color to different variable in ODS

Posted in reply to sathishthangamani

I found the below link, thought would be helpful to you.

http://support.sas.com/kb/23/353.html

Thanks,

Jagadish

Thanks,
Jag
Super User
Posts: 11,343

Re: SAS Proc format color - How to compare value and assign color to different variable in ODS

Posted in reply to sathishthangamani

It may be as simple as missing the period at the end of the MY_SCRATVOL format, should read MY_SCRATVOL. otherwise SAS is looking for a known specific color with that name and most likely not finding it.

Occasional Contributor
Posts: 10

Re: SAS Proc format color - How to compare value and assign color to different variable in ODS

Posted in reply to sathishthangamani

Thanks for you responses. Yes the period at the end will fix this.

I will brief a bit...

I have two variables SCRATVOl & SCRATTHR.

I want to color SCRATVOL variable by comparing against SCRATTHR and mark the color in RED, YELLOW, WHITE for SCRATVOL.

Please let me know if ity is possible.

Thanks, Sathish

Super User
Posts: 19,772

Re: SAS Proc format color - How to compare value and assign color to different variable in ODS

Posted in reply to sathishthangamani

You can but you do need proc report I think. Just change the condition in the calculate column as per the example linked to in post above.

Occasional Contributor
Posts: 10

Re: SAS Proc format color - How to compare value and assign color to different variable in ODS

It really worked, still trying to get the Multiple observation into one row... having difficult times... any advise would be appreciated.

Super User
Posts: 11,343

Re: SAS Proc format color - How to compare value and assign color to different variable in ODS

Posted in reply to sathishthangamani

Time to show what you want the output to look like. "Multiple observation into one row" is not intuitively obvious what the desired output may be.

Ask a Question
Discussion stats
  • 6 replies
  • 345 views
  • 0 likes
  • 4 in conversation