Modifying Colors in PROC SGPLOT

Reply
Contributor
Posts: 30

Modifying Colors in PROC SGPLOT

For some reason this code is not working on my computer.  I can not get the color scheme I want to show up.  Can someone else run it and let me know if they experience the same problem?

data work.bp;
  infile datalines;
  input dias losys hisys grp $ 13-33 refx refy;
datalines;
75 110 190 Severe Hypertension 75 140
115 110 190 Severe Hypertension 90 140
75 110 180 Moderate Hypertension 90 190
110 110 180 Moderate Hypertension . .
75 110 160 Mild Hypertension . .
100 110 160 Mild Hypertension . .
75 110 140 High/Normal . .
90 110 140 High/Normal . .
75 110 130 Normal . .
85 110 130 Normal . .
75 110 120 Optimal . .
80 110 120 Optimal . .
;
run;

proc template;
  define style styles.bp;
  parent=styles.listing;
  style graphcolors from graphcolors /
  'gdata6'=CXFFFFFF
  'gdata5'=CXF5D9D8
  'gdata4'=CXEBB3B1
  'gdata3'=CXE18D8A
  'gdata2'=CXD76763
  'gdata1'=CXBF1810;
  end;
run;

ods listing style=bp;
title 'Stages of Hypertension';

proc sgplot data=bp;
  band x=dias lower=losys upper=hisys /
  group=grp name="bp";
  series x=refx y=refy / lineattrs=(thickness=2);
  xaxis values=(75 to 115 by 5) label='Diastolic Pressure (mmHg)';
  yaxis values=(110 to 190 by 10) label='Systolic Pressure (mmHg)';
  keylegend "bp" / position=right across=1 title='Stage';
  inset "Isolated" "Systolic" "Hypertension" / position=left textattrs=graphlabeltext;
run;

Super User
Posts: 10,483

Re: Modifying Colors in PROC SGPLOT

Listing destination pretty much ignores the ODS styles.

If your looking at a graph in the Results window, that isn't listing output and is likely using your default style. Try ODS HTML style=BP; and see what you get.

Ask a Question
Discussion stats
  • 1 reply
  • 141 views
  • 0 likes
  • 2 in conversation