Quartz | Level 8

## Quadratic graphs in proc sgplot

ods graphics on;
proc logistic data=HEERDT.VPICU_label plots(only)=effect(x=Ind_SBP1 connect yrange=(0,1) cl );
model VP24_VasoNE_012(ref='0') = Ind_SBP1 |Ind_SBP1 / nooddsratio link=glogit ct covb clodds=wald;
where VP24_VasoNE_012 NE 1;
title '';
run;

Above is the code I used to contruct a graph  in an ordinal logistic regression, with a quadratic transformation of a continuous independent variable.

I didn't seem to have many choices here in terms of changing the title, getting rid of gridlines, adjusting the axes etc.

Is there a better way using proc sgplot or otherwise?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: Quadratic graphs in proc sgplot

You can get the data for that graph using ODS and then use PROC SGPLOT to customize it as desired.

6 REPLIES 6
Super User

## Re: Quadratic graphs in proc sgplot

You can get the data for that graph using ODS and then use PROC SGPLOT to customize it as desired.

Quartz | Level 8

## Re: Quadratic graphs in proc sgplot

Thanks for that Reeza.

Its working beautifully although the graphs from the logistic output and sgplot look a little different.

If I needed to choose specific colors for the estimate and boundary lines as well as shading, how would one do that?

Super User

## Re: Quadratic graphs in proc sgplot

Depending on how complex your SG procedure is, most statements have options for specifying line colors and such.

Or you can use Attribute Maps:

https://blogs.sas.com/content/iml/2017/01/30/auto-discrete-attr-map.html

Quartz | Level 8

## Re: Quadratic graphs in proc sgplot

Ok, so I am playing about with some choices I found.

proc sgplot data = QuadSBPVp ;
Title "Severe Vasolegia up to 24h by Induction SBP";
band x=Ind_SBP1 lower=l upper=u;
YAXIS label = "Estimated probably of Severe Vasoplegia in 1st 24 hours";
series x = Ind_SBP1 y = fit/ curvelabel = "Predicted value" lineattrs=(color= Blue pattern=dash);;
series x = Ind_SBP1 y = u/ curvelabel = "95% Upper CI" lineattrs= (color=purple pattern=dash);
series x = Ind_SBP1 y = l/ curvelabel = "95% Lower CI"lineattrs = (color = yellow pattern = solid thickness =5);
run;

How do I assign a specific colour to the band (the shaded area between the CI's?

Besides standard colours, how to I specify an exact colour, eg:

Colour 1 (blue): c100 m57 y0 k2
Colour 2 (green): c71 m26 y100 k25
Colour 3 (Pink): c10 m70 y0 k0
Colour 4 (gold): c0 m50 y100 k0
Colour 5 (light blue): c80 m0 y0 k0
Colour 6 (orange): c0 m80 y100 k0

These are critical to get right as they are the only colours the journal I am aiming for will accept.

Super User

## Re: Quadratic graphs in proc sgplot

Use Hex coding with CX in front of it when specifying colours.

Color = CXffffff

You can consider a BAND statement for your confidence limits, then you can specify a shading to be filled in between the lines.

Quartz | Level 8

## Re: Quadratic graphs in proc sgplot

@Reeza wrote:

Depending on how complex your SG procedure is, most statements have options for specifying line colors and such.

Or you can use Attribute Maps:

https://blogs.sas.com/content/iml/2017/01/30/auto-discrete-attr-map.html

Discussion stats
• 6 replies
• 2603 views
• 1 like
• 2 in conversation