Data visualization with SAS programming

ROC Curve ODS Displays

Accepted Solution Solved
Reply
Frequent Contributor
Frequent Contributor
Posts: 106
Accepted Solution

ROC Curve ODS Displays

I am trying to overlay predictors from a logistic regression using ROC curves. I have done this many times, but noticed when using the below code, I do not get the same figures as in the SAS document, see link. In particular, my lines in the "ROC Curves for Comparisons" do not have patterns (i.e., not dashed). I would like the patterned lines, in that the image will be saved in black and white for publication purposes. 

 

I will note, I am using SAS 9.4 and the example comes from SAS 9.2. I only have access to 9.4 and does anyone have a way for me to make lines patterned or distinguishable in a black and whiite image.

 

Thanks,

 

H

 

Example output that I desire:

https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_logistic_se...

 

Code I am using:

   data roc;
      input alb tp totscore popind @@;
      totscore = 10 - totscore;
      datalines;
   3.0 5.8 10 0   3.2 6.3  5 1   3.9 6.8  3 1   2.8 4.8  6 0   
   3.2 5.8  3 1   0.9 4.0  5 0   2.5 5.7  8 0   1.6 5.6  5 1   
   3.8 5.7  5 1   3.7 6.7  6 1   3.2 5.4  4 1   3.8 6.6  6 1   
   4.1 6.6  5 1   3.6 5.7  5 1   4.3 7.0  4 1   3.6 6.7  4 0   
   2.3 4.4  6 1   4.2 7.6  4 0   4.0 6.6  6 0   3.5 5.8  6 1   
   3.8 6.8  7 1   3.0 4.7  8 0   4.5 7.4  5 1   3.7 7.4  5 1   
   3.1 6.6  6 1   4.1 8.2  6 1   4.3 7.0  5 1   4.3 6.5  4 1   
   3.2 5.1  5 1   2.6 4.7  6 1   3.3 6.8  6 0   1.7 4.0  7 0   
   3.7 6.1  5 1   3.3 6.3  7 1   4.2 7.7  6 1   3.5 6.2  5 1   
   2.9 5.7  9 0   2.1 4.8  7 1   2.8 6.2  8 0   4.0 7.0  7 1   
   3.3 5.7  6 1   3.7 6.9  5 1   3.6 6.6  5 1   
   ;

      ods graphics on;
   proc logistic data=roc plots=roc(id=prob);
      model popind(event='0') = alb tp totscore / nofit;
      roc 'Albumin' alb;
      roc 'K-G Score' totscore;
      roc 'Total Protein' tp;
      roccontrast reference('K-G Score') / estimate e;
   run;
   ods graphics off;

 

 


Accepted Solutions
Solution
‎03-08-2017 02:28 PM
Grand Advisor
Posts: 16,349

Re: ROC Curve ODS Displays

What's your output destination, PDF, RTF?

 

Anyways, change the style to Journal, Journal1 or something in that family. 

View solution in original post


All Replies
Solution
‎03-08-2017 02:28 PM
Grand Advisor
Posts: 16,349

Re: ROC Curve ODS Displays

What's your output destination, PDF, RTF?

 

Anyways, change the style to Journal, Journal1 or something in that family. 

Frequent Contributor
Frequent Contributor
Posts: 106

Re: ROC Curve ODS Displays

NO output destination. I am reviewing and grabbing the image from the "Results Review" window.

Frequent Contributor
Frequent Contributor
Posts: 106

Re: ROC Curve ODS Displays

[ Edited ]

The first attachment is the desired graph and the second is what I get.

Attachment
Attachment
Frequent Contributor
Frequent Contributor
Posts: 106

Re: ROC Curve ODS Displays

Yes, that worked, but I had wondered why there was this difference as well, Is it a version change?  Attached is the Journal style version.

 

Thank you,

Attachment
SAS Super FREQ
Posts: 1,044

Re: ROC Curve ODS Displays

With SAS 9.3, the HTML destination uses the HTMLBlue style that has an ATTRPRIORITY=COLOR.  This means that group values first get different colors only.  When all 12 colors are used (with solid pattern), then the pattern (or marker symbol) changes to the next one.  If you want the color and pattern (or symbol) to change with each group, use one of the ATTRPRIORITY=NONE styles (almost all other SAS shipped styles).  You can also change the style behavior by specifying ATTRPRIORITY on the ODS Graphics statement.

 

See:  http://blogs.sas.com/content/graphicallyspeaking/2015/06/28/attributes-priority-for-the-inquiring-mi...

Occasional Contributor
Posts: 6

Re: ROC Curve ODS Displays

I am also trying to get black and white gragh. Can I have code for this black and white graph?

 

Thanks,

Bikash

Frequent Contributor
Frequent Contributor
Posts: 106

Re: ROC Curve ODS Displays

I believe this was the code piece I used, attention to the "Journal" part.

 

ods graphics on;
ods html style=Journal;
proc logistic data=pct_post plots=roc(id=prob);
	where final_pna_result ne 1;
	MODEL Final_PNA_result (event = '2') =	PCT_1_c							                                                        Temperature_in_ER
										WBC_1	/ nofit;
	roc 'Procalcitonin'  PCT_1_c;
	roc 'Temperature' Temperature_in_ER;
	roc 'White Blood Cell Count' WBC_1;
    roccontrast reference('Procalcitonin') / estimate e;
run;
ods graphics off;
Occasional Contributor
Posts: 6

Re: ROC Curve ODS Displays

Thank you,


Occasional Contributor
Posts: 6

Re: ROC Curve ODS Displays

Got you. Are there any way to change the pattern of lines like:----x-x-x-x or ----o-o-o-o-o-- ? I really want to this types of lines.

 

Thanks,

Bikash 

Frequent Contributor
Frequent Contributor
Posts: 106

Re: ROC Curve ODS Displays

[ Edited ]

I don't know how to change line styles. I would imagine Sanjay or others may know how and it may require changing template settings or some code intensive process. I agree that it would be nice if that was a readily accessible option/process.

 

Grand Advisor
Posts: 16,349

Re: ROC Curve ODS Displays

@bikashten are you expecting the line to be X/O's or to be a dashed line with X/O's for the points?

Occasional Contributor
Posts: 6

Re: ROC Curve ODS Displays

different patterns of lines so that reviews can easily visualize the differences between the treatments..

SAS Super FREQ
Posts: 1,044

Re: ROC Curve ODS Displays

It seems to me this issue was resolved (as marked).  However, if you want to change the actual patterns using PROC LOGISTIC, you need to change the associated Style.  You can use PROC TEMPLATE, or the %MODSTYLE macro to derive a new style from JOURNAL with the changed patterns and then use that style on the destination.

 

If you are using SAS 9.40 or later wityh PROC SGPLOT, you can change the patterns in the code directly using the STYLEATTRS statement.

Post a Question
Discussion Stats
  • 13 replies
  • 157 views
  • 7 likes
  • 4 in conversation