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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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