Data visualization with SAS programming

Quadratic graphs in proc sgplot

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 77
Accepted Solution

Quadratic graphs in proc sgplot

[ Edited ]

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?

 


Accepted Solutions
Solution
‎01-29-2018 11:57 AM
Super User
Posts: 22,875

Re: Quadratic graphs in proc sgplot

Posted in reply to ChristosK

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

View solution in original post


All Replies
Solution
‎01-29-2018 11:57 AM
Super User
Posts: 22,875

Re: Quadratic graphs in proc sgplot

Posted in reply to ChristosK

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

Frequent Contributor
Posts: 77

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
Posts: 22,875

Re: Quadratic graphs in proc sgplot

Posted in reply to ChristosK

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

 

 

Frequent Contributor
Posts: 77

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
Posts: 22,875

Re: Quadratic graphs in proc sgplot

Posted in reply to ChristosK

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. 

Frequent Contributor
Posts: 77

Re: Quadratic graphs in proc sgplot

[ Edited ]

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

 

 


 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 161 views
  • 0 likes
  • 2 in conversation