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

Hi,

      I am generating a plot using proc loess as shown below.  The output has extra titles I am trying to suppress (and have been successful partially using "ods noptitle").  Can someone advise how I can suppress these titles from my output (since this information is in the plot and is redundant)? 

Selected Smoothing Parameter: x

Dependent Variable: xyz

 

 

ods noptitle;

ods select fitplot;
proc loess data=test;
model dependent = independent /interp=linear degree=1 select=AICC(presearch);
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

It seems to me that the easiest way to get your plot is to use the OUTPUT statement to save the predicted values. Then sort the data by the independent variable and use PROC SGPLOT to overlay the predicted values on the observed values:

 

/* create sample data */
data test;
set sashelp.class;
dependent=weight; independent=height;
keep dependent independent;
run;

/* fit loess curve. Save predicted values to SAS data set */
proc loess data=test plots(only)=fitplot;
model dependent = independent /interp=linear degree=1 select=AICC(presearch);
output out=LoessOut predicted=Pred;
run;

/* sort by X */
proc sort data=LoessOut;
by independent;
run;

title "My own title";  /* if you want a title, use this */ 
title;                 /* or do not use any title */
proc sgplot data=LoessOut;
scatter x=independent y=dependent;
series x=independent y=Pred;
run;

View solution in original post

7 REPLIES 7
ballardw
Super User

Do the titles look they might have come from previous TITLE statements?

Try adding:

title;

before the procedure to clear any previous title definitions.

The ODS NOPTITLE only removes Procedure titles such as PROC LOESS or PROC FREQ, not TITLE statements.

lpcovance
Calcite | Level 5

Thanks for your response Warren!  I used GTL to get rid of the "Fit plot for ..." title.  I then proceeded to remove all my titles and added in title; title1; statements.  They still seem to have no effect on the 2 titles "Smoothing Parameter..." and "Dependant Variable...".  I am attaching the output file so it helps you visualize this issue.  It seems like these titles are generated by the PROC and the external title statements do not have any bearing on them.  Please let me know if you can think of any possible way I can address this.     

lpcovance
Calcite | Level 5

Thanks for the response Warren!  I actually did take a look at your %grtitle blog post and tried using that, but that does not seem to work with Proc LOESS.  So I used GTL instead and it helped to some extent - I was able to remove the "Fit Plot for ..." title.  However I still have these 2 titles (file attached).  The the title; statement does not seem to have any effect on these.  I appreciate any help on this matter.

PGStats
Opal | Level 21

You will have better control on graphical appearance, at the expense of less control about loess computation, with the loess statement available in proc sgplot. 

PG
Rick_SAS
SAS Super FREQ

It seems to me that the easiest way to get your plot is to use the OUTPUT statement to save the predicted values. Then sort the data by the independent variable and use PROC SGPLOT to overlay the predicted values on the observed values:

 

/* create sample data */
data test;
set sashelp.class;
dependent=weight; independent=height;
keep dependent independent;
run;

/* fit loess curve. Save predicted values to SAS data set */
proc loess data=test plots(only)=fitplot;
model dependent = independent /interp=linear degree=1 select=AICC(presearch);
output out=LoessOut predicted=Pred;
run;

/* sort by X */
proc sort data=LoessOut;
by independent;
run;

title "My own title";  /* if you want a title, use this */ 
title;                 /* or do not use any title */
proc sgplot data=LoessOut;
scatter x=independent y=dependent;
series x=independent y=Pred;
run;
lpcovance
Calcite | Level 5

This worked out for me perfectly!  Thank you so much for taking the time to look into this issue and providing a solution.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 3002 views
  • 0 likes
  • 5 in conversation