Programming the statistical procedures from SAS

Changing line colors and patterns in overlaid roc curves, proc sgplot

Reply
Frequent Learner
Posts: 1

Changing line colors and patterns in overlaid roc curves, proc sgplot

I'm trying to use three different colors and patterns for three overlaid ROC curves. I'm using the following code but it's not giving me the result I want. Any suggestions?

 

PROC sgplot DATA=overlayuc4 aspect=1;
    title 'mytitle';
    xaxis values=(0 to 1 by 0.10) grid offsetmin=.05 offsetmax=.05;
    yaxis values=(0 to 1 by 0.10) grid offsetmin=.05 offsetmax=.05;
    xaxis label='False Alarm Rate (1 - Specificity)';
    yaxis label='Hit Rate (Sensitivity)';
    lineparm x=0 y=0 slope=1 / transparency=.7;
    series x=_1mspec_ y=_sensit_/ name='Outcome1' lineattrs=(pattern=solid) legendlabel='Outcome1';
    series x=_1mspec_ y=_sensit_/ name='Outcome2' lineattrs=(pattern=shortdash) legendlabel='Outcome2';
    series x=_1mspec_ y=_sensit_/ name='Outcome3' lineattrs=(pattern=longdash) legendlabel='Outcome3';
    keylegend 'Outcome1' 'Outcome2' 'Outcome3';
RUN;

Super User
Posts: 9,769

Re: Changing line colors and patterns in overlaid roc curves, proc sgplot

How about this one.


proc sort data=sashelp.class out=class;
by age;
run;

ods graphics/reset attrpriority=none;
proc sgplot data=class;
styleattrs datacolors=(green red) datacontrastcolors=(green red) 
           datalinepatterns=(solid dash) ;          
series x=age y=height;
series x=age y=weight;
run;
 
Super User
Posts: 18,549

Re: Changing line colors and patterns in overlaid roc curves, proc sgplot


zglendening wrote:

I'm trying to use three different colors and patterns for three overlaid ROC curves. I'm using the following code but it's not giving me the result I want. Any suggestions?

 

PROC sgplot DATA=overlayuc4 aspect=1;
    title 'mytitle';
    xaxis values=(0 to 1 by 0.10) grid offsetmin=.05 offsetmax=.05;
    yaxis values=(0 to 1 by 0.10) grid offsetmin=.05 offsetmax=.05;
    xaxis label='False Alarm Rate (1 - Specificity)';
    yaxis label='Hit Rate (Sensitivity)';
    lineparm x=0 y=0 slope=1 / transparency=.7;
    series x=_1mspec_ y=_sensit_/ name='Outcome1' lineattrs=(pattern=solid) legendlabel='Outcome1';
    series x=_1mspec_ y=_sensit_/ name='Outcome2' lineattrs=(pattern=shortdash) legendlabel='Outcome2';
    series x=_1mspec_ y=_sensit_/ name='Outcome3' lineattrs=(pattern=longdash) legendlabel='Outcome3';
    keylegend 'Outcome1' 'Outcome2' 'Outcome3';
RUN;


1. What does 'not giving me the result I want' mean? 

2.Ideally post using a sample dataset so your issue can be replicated quickly. I'm too lazy to make up data to test your code. 

3. What version of SAS are you using? The graphing options have changed a lot in last iterations and that means different options are available. %put sysvlong; to get version if you don't know it. 

Ask a Question
Discussion stats
  • 2 replies
  • 158 views
  • 0 likes
  • 3 in conversation