BookmarkSubscribeRSS Feed
turcay
Lapis Lazuli | Level 10

Following reports are created on Excel. My purpose is to learn how i can create these reports by SAS code or on EG.

 

I just want you to guide me i will spare time 🙂

 

Is it possible to create ROC Curve by using Line Plot and Scatter Plot. Maybe i have to use ANNOVA graphic’s on EG.

 

Roc&Curve.png

If i create the Traffic Lights Report by using Line Plot how i can add the colors. I created the colors on table by using Proc Report through IF-ELSE Condition now i have to add colors on Line Plot.

 

Traffic.png

 

I think I should use Bar-Line graphic for following graphic but there is a limit on Bar statement.

 

Graphşc.png

 

I guess i can create following report on EG in an easy way.

 

Line3.png

 

This was the first time i tried to create following reports. So i haven’t got many information related to these reports i f i get some helps it will be beneficial for me.

 

Could you lead me, please ?

 

Thank you.

14 REPLIES 14
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Go over to this blog:

http://blogs.sas.com/content/graphicallyspeaking/

 

And look through the thousands of examples, with code in both GTL and sgplot.  Everything you could possible want to know about graphs is there.

 

Rick_SAS
SAS Super FREQ

You can create ROC plots automatically by using PROC LOGISTIC.

ods graphics on;
proc logistic data=sashelp.class plots(only)=roc;
   model sex = height / outroc=roc;
run;

If you need to do something fancy, the OUTROC= option writes the ROC data to an output data set.

 

Rick_SAS
SAS Super FREQ

The non-ROC plots are merely graphs that overlay standard elements such as bars, lines, reference lines, bands, etc.

 

Post your particular questions along with sample data to the SAS/GRAPH and ODS Graphics Support Community and say "I want to learn how to create this graph by using PROC SGPLOT."  They are easy to create once you learn the basic techniques.

turcay
Lapis Lazuli | Level 10

Thank you,

During this period you helped me a lot and i think you are expert of SAS. I asked my question SAS/GRAPH and ODS Graphics Support Community page as you said. I've already tried proc logistic but i didn't get the desired result which Excel generated. MM and EM generate ROC Curve easily i wonder how i can see the code behind of program maybe i can get some helps. I think it is hard to discover how to create these report in the beginning ?

 

Thanks again

Rick_SAS
SAS Super FREQ

You are welcome. I'm sure that it won't be long before you that you are making awesome graphs in SAS.

 

The quickest way to get a helpful response is to provide sample data. Often someone will be able to respond with the exact procedure and statements that you need. Since you are interesting in creating graphs, see the article "How to ask a good question about graphing in SAS"

turcay
Lapis Lazuli | Level 10

Rick,

Your replies are always very accurate. I can receive the information i need from you. I will consider your suggestion. As far as i understand the main point is to provide sample data.

Thanks.

Reeza
Super User
Look at robslink.com for a lot of graphs and the full code/data behind them.
turcay
Lapis Lazuli | Level 10

Hello Reeza,

 

This is the first time you answered without being angry 🙂 also it is beneficial for me.

 

Thank you.

ChrisHemedinger
Community Manager

@Reeza never strikes me as anything but helpful and nice, but maybe we need to introduce a new badge to the communities!

 

angry.png

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!
turcay
Lapis Lazuli | Level 10

I created the Roc Curve by using PROC GPLOT procedure. I hope it is the correct method.

 

 

PROC GPLOT DATA = <dataset>;
PLOT column1* column2  column2*column2/
 OVERLAY
	VAXIS=AXIS1

	HAXIS=AXIS2

FRAME	CFRAME=CXD2D2D2
	LVREF=1
	CVREF=BLACK
	AUTOVREF
	NOLEGEND
;
	FORMAT column2 PERCENT8.
		column1 PERCENT8.;
RUN; 
QUIT;

Thanks a lot.

 

StatDave
SAS Super FREQ

Given a data set with variables containing the sensitivity and specificity values (such as the OUTROC= data set from PROC LOGISTIC), these statements effectively reproduce the ROC graph produced by PROC LOGISTIC.  See the options in PROC SGPLOT if you want to makes alterations.

 

proc sgplot data=rocdata noautolegend aspect=1;
xaxis values=(0 to 1 by 0.25) grid offsetmin=.05 offsetmax=.05;
yaxis values=(0 to 1 by 0.25) grid offsetmin=.05 offsetmax=.05;
lineparm x=0 y=0 slope=1 / transparency=.7;
series x=_1mspec_ y=_sensit_;
run;

turcay
Lapis Lazuli | Level 10

Thanks a lot @StatDave It's good to know this. 

 

I created my last posted report which has logbase10 Axises. I used th GPLOT procedure again. You can see the code as below.

 

PROC GPLOT DATA = <dataset>
PLOT Column2* Column1
Column1* Column1
Column3* Column1
/
 OVERLAY
 GRID
	VAXIS=AXIS1

	HAXIS=AXIS2

	FRAME CFRAME=CXD4D4D4
	CVREF=CX969696
	CHREF=CX969696

FRAME	NOLEGEND;
FORMAT Column2 PERCENT11.4
		Column1 PERCENT11.4;
RUN; 
QUIT;
turcay
Lapis Lazuli | Level 10

I created the traffic lights report by using Pattern and Areas option. You can see the code below

 

pattern1 v=s c=White;
pattern2 v=s c=Green;
pattern3 v=s c=yellow;
pattern4 v=s c=yellow;

 

PROC GPLOT DATA =<dataset>;
PLOT Column1* Column Column3* Column
Column2* Column Column4* Column/
 OVERLAY
	VAXIS=AXIS1

	HAXIS=AXIS2
	AREAS=1 
	AREAS=2 
	AREAS=3 
	AREAS=4
	AUTOVREF 
	
	HREVERSE
FRAME	 CFRAME=RED
LEGEND=LEGEND1
;
	FORMAT 
		Column1 PERCENT8.
		Column2 PERCENT8.
		Column3 PERCENT8.
		Column4 PERCENT8.;

RUN; 
QUIT;

 

On my third report, i would like to create both bars and lines. I'm working on EG and i'm also trying to use SAS codes but i couldn't create the both bars and both lines. Firstly, i tried to use PROC GCHART(Bar Chart on EG) i added the column1 into 'Column to chart' for horizontal axes and i added column1 and column2 into 'Sum of' which generated bars.By using this method i could create the bars which i wanted but i can't create the lines on PROC GHART. I also used PROC GBARLINE(Bar-Line on EG) i could create the lines and a bar but there is a bar limit on PROC GBARLINE for this reason i can't create two bars on PROC GBARLINE. I searched on google and some forums/blogs of SAS but i couldn't what i want. If somebody have knowledge about this can s/he share an example which includes two bars and three lines to help me, please ? I've already checked many procedure on google and some blogs. Seeing an example will be the best method for me to understand well.

 

Thank you.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 14 replies
  • 3939 views
  • 9 likes
  • 6 in conversation