Data visualization with SAS programming

Changing Main Title for Fit Plot in Proc GLM

Accepted Solution Solved
Reply
Contributor
Posts: 24
Accepted Solution

Changing Main Title for Fit Plot in Proc GLM

[ Edited ]

I sincerely hope this question has not been posted already since I do hate wasting the time of others. With that said, how do I change the Main Title in the fit plot produced by PROC GLM. For example, in the plot below, how do I change "Fit Plot for mpg" to lets say "Fit plot for Miles per Gallon". As far as I know, changing the label for the variable will not do this.

 

Fit Plot

 

 

Accepted Solutions
Solution
‎01-06-2017 07:06 PM
Respected Advisor
Posts: 4,609

Re: Changing Main Title for Fit Plot in Proc GLM

You would normally need to play with the graph template. I find it less trouble to OUTPUT the predicted and limit values and produce my own graph with SGPLOT. But in this case, you could get away with a renaming the variable to a literal name:

 

option validvarname=any;
proc glm data=sashelp.cars(rename=mpg_city='Miles Per Gallon'n) plots(only)=fitplot;
model 'Miles Per Gallon'n = horsepower;
run;

FitPlot1.png

PG

View solution in original post


All Replies
Solution
‎01-06-2017 07:06 PM
Respected Advisor
Posts: 4,609

Re: Changing Main Title for Fit Plot in Proc GLM

You would normally need to play with the graph template. I find it less trouble to OUTPUT the predicted and limit values and produce my own graph with SGPLOT. But in this case, you could get away with a renaming the variable to a literal name:

 

option validvarname=any;
proc glm data=sashelp.cars(rename=mpg_city='Miles Per Gallon'n) plots(only)=fitplot;
model 'Miles Per Gallon'n = horsepower;
run;

FitPlot1.png

PG
Contributor
Posts: 24

Re: Changing Main Title for Fit Plot in Proc GLM

[ Edited ]

Wow that's crazy. I didn't realize you could change variable names to literal ones. I would also like to add that variable names are still limited to 32 characters which would also limit the title length using the above method.

Grand Advisor
Posts: 10,251

Re: Changing Main Title for Fit Plot in Proc GLM

You could change the template for the Fit plot  (Stat.GLM.Graphics.Fit).

The change would be to modify the line:

entrytitle _TITLE " for " _DEPNAME;

to

entrytitle _TITLE " for " _DEPLABEL;

to use the dependent variable label in the title.

 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 272 views
  • 3 likes
  • 3 in conversation