New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
kcvaldez98
Obsidian | Level 7

Hi Sas coders!

 

I create a linear regression that looks like this: Screen Shot 2023-12-07 at 9.48.22 AM.png

I am trying to change the Frequent_Mental_Distress in the Fit plot title to say: Fit Plot for Frequent Mental Distress without any of the underscores, I tried doing IF THEN statements and renaming statements but I don't know if I can use labels to be displayed in the fit plot title. Is that possible? My label would be "Percent of people with Frequent Mental Distress"

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
kcvaldez98
Obsidian | Level 7
PROC REG DATA=WORK.FIGURE (RENAME=outcomes_adults_mental_distr='Frequent Mental Distress'n)  
PLOTS(ONLY) = FITPLOT;
  LABEL Marijuana_Use = 'Percent of People Who Used Marijuana 1+ Days out of 30 Days';
  'Linear Regression'n:
  MODEL 'Frequent Mental Distress'n = Marijuana_Use /
        CLM
        CLI 
        ALPHA=0.05; 

  TITLE "Linear Regression of Frequent Mental Distress and Marijuana Use";
  ODS SELECT FitPlot;
RUN;

View solution in original post

5 REPLIES 5
ballardw
Super User

It is much easier to show where changes to your code may be desired if you show the code you used to make to make the plot.

 

For one thing there are more than one procedures that do linear regression and they are likely to have some different options.

kcvaldez98
Obsidian | Level 7

My code is:

OPTIONS VALIDVARNAME=ANY;
PROC REG DATA=WORK.FIGURE (RENAME = outcomes_adults_mental_distr = Frequent_Mental_Distress) 
PLOTS(ONLY) = FITPLOT;
  LABEL Marijuana_Use = 'Percent of People Who Used Marijuana 1+ Days out of 30 Days';
  'Linear Regression'n:
  MODEL Frequent_Mental_Distress = Marijuana_Use /
        CLM
        CLI 
        ALPHA=0.05; 

  TITLE "Linear Regression of Frequent Mental Distress and Marijuana Use";
  ODS SELECT FitPlot;
RUN;
TITLE;

Thank you so much! I thought there was only like two procedures but good to know that there are more!

kcvaldez98
Obsidian | Level 7
I figured it out, thank you
ballardw
Super User

@kcvaldez98 wrote:
I figured it out, thank you

Great!.

Please post an example of your solution and mark it as an accepted solution. That way others searching this forum, or brought here by a search engine, can benefit from your example.

kcvaldez98
Obsidian | Level 7
PROC REG DATA=WORK.FIGURE (RENAME=outcomes_adults_mental_distr='Frequent Mental Distress'n)  
PLOTS(ONLY) = FITPLOT;
  LABEL Marijuana_Use = 'Percent of People Who Used Marijuana 1+ Days out of 30 Days';
  'Linear Regression'n:
  MODEL 'Frequent Mental Distress'n = Marijuana_Use /
        CLM
        CLI 
        ALPHA=0.05; 

  TITLE "Linear Regression of Frequent Mental Distress and Marijuana Use";
  ODS SELECT FitPlot;
RUN;

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1275 views
  • 0 likes
  • 2 in conversation