BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Manj
Fluorite | Level 6

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;

 

 

Manj_0-1615827700891.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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;

View solution in original post

3 REPLIES 3
Rick_SAS
SAS Super FREQ

Is this for a class?

Rick_SAS
SAS Super FREQ

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;
Manj
Fluorite | Level 6

Thanks. It worked well.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2089 views
  • 1 like
  • 2 in conversation