- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I using the following code to build the plot attached. I would need to change the attributes of the lines to pink solid line and green dashed line. At present it is showing blue and red solid lines be default. Anyone suggest a method to change the attributes?
ods listing close;
ods pdf file="&g_outfile..&g_fontsize" nobookmarkgen style=idsl dpi=600 ;
ods noproctitle ;
title1 j=l height=10pt "Protocol: %upcase(&g_study_id)" j=r "Page 1 of 1";
title2 j=l height=10pt "Population: &g_poplbl";
title3 j=center "Figure &g_dsplynum";
title4 j=center "&g_title1 ";
title5 %if &g_title2 = %then %do; color = white "." %end; %else %do; j=center "&g_title2." %end;;
*footnote1 j=left h=9pt "&g_foot1";
Footnote1 j=left h=9pt j=left "&g_userid: &g_pgmpth &sysdate9 &systime";
proc univariate data=sf36_obs noprint ;
class trtppn ;
var chg;
cdfplot /overlay odstitle=none ;
run;
ods pdf close;
ods listing;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can do it by changing the ODS style, but many people find it easier to use ODS OUTPUT to write the data underlying the graph to a SAS data set, and then use PROC SGPLOT to customize the graph.
To get the pink/green and line styles, make sure you are using AttrPriority=None on the ODS GRAPHICS statement. You can then use the STYLEATTRS statement to specify the line colors and patterns, as follows:
data A;
set sashelp.cars;
where origin in ('USA' 'Asia');
run;
proc univariate data=A noprint ;
class origin;
var mpg_city;
cdfplot /overlay odstitle=none ;
ods output CDFPlot = OutCDF;
run;
ods graphics / AttrPriority=None;
title "My CDF Plot";
proc sgplot data=outCDF noautolegend;
styleattrs DATACONTRASTCOLORS=(Pink DarkGreen) DATALINEPATTERNS=(solid dash);
step x=ECDFX y=ECDFY / group=Class1; /* variable names created by PROC UNIVARIATE */
xaxis grid;
yaxis grid min=0 label="Cumulative Proportion";
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Is this for a class?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can do it by changing the ODS style, but many people find it easier to use ODS OUTPUT to write the data underlying the graph to a SAS data set, and then use PROC SGPLOT to customize the graph.
To get the pink/green and line styles, make sure you are using AttrPriority=None on the ODS GRAPHICS statement. You can then use the STYLEATTRS statement to specify the line colors and patterns, as follows:
data A;
set sashelp.cars;
where origin in ('USA' 'Asia');
run;
proc univariate data=A noprint ;
class origin;
var mpg_city;
cdfplot /overlay odstitle=none ;
ods output CDFPlot = OutCDF;
run;
ods graphics / AttrPriority=None;
title "My CDF Plot";
proc sgplot data=outCDF noautolegend;
styleattrs DATACONTRASTCOLORS=(Pink DarkGreen) DATALINEPATTERNS=(solid dash);
step x=ECDFX y=ECDFY / group=Class1; /* variable names created by PROC UNIVARIATE */
xaxis grid;
yaxis grid min=0 label="Cumulative Proportion";
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. It worked well.