<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic CONTRAST v. ESTIMATE statements - multivariable linear regression in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906062#M44968</link>
    <description>&lt;P&gt;I am running a multivariable linear regression and want to compare adjusted means of the&amp;nbsp;dependent variable (mean_sbp) at given values of the&amp;nbsp;independent variable (joint_years). Both variables are continuous. I am using proc glm for the regression. I want to be able to easily compare the adjusted mean_sbp at 5 joint_years to 15 joint_years. Or, compare the&amp;nbsp;mean_sbp of the median of joint_years to the 99th percentile of joint_years.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Googling and ChatGPT suggest using the&amp;nbsp;CONTRAST v. ESTIMATE statements, but I can't seem to figure it out.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I realize I could create categorical versions of&amp;nbsp;joint_years and use it as a categorical variable, but I'd like something a little more flexible.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are some approaches I have tried:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc mixed data=work.finallabel_6;
    class race1c gender1 income6 educ1 htn_meds lipid_meds dm_meds;
    model mean_sbp = joint_years race1c gender1 age6c income6 educ1 drinks_wk pkyrs6c pamvcm6c
                   bmi6c tchol_hdl_ratio hba1c6 glucose6 htn_meds lipid_meds dm_meds totmed6;
    
&lt;FONT color="#FF0000"&gt;    estimate 'Mean at joint_years=5' joint_years 1 / atmean joint_years=5;
    estimate 'Mean at joint_years=15' joint_years 1 / atmean joint_years=15;&lt;/FONT&gt;

    format 
    race1c race1c.
    gender1 gender1f.
    income6 income6fmt.
    educ1 educ1fmt.
    htn_meds
    lipid_meds 
    dm_meds yes_no_fmt.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glm data=mesa.finallabel_6;
	class race1c gender1 income6 educ1 htn_meds lipid_meds dm_meds; 
	
    model mean_sbp = joint_years race1c gender1 age6c income6 educ1 drinks_wk pkyrs6c pamvcm6c 
    bmi6c tchol_hdl_ratio hba1c6 glucose6 htn_meds lipid_meds dm_meds totmed6 / solution clparm;
    
&lt;FONT color="#FF0000"&gt;/*  estimate 'Difference at joint_years=0 vs joint_years=23' joint_years 1 -1; */

/* 	Use the estimate statement to compare the adjusted mean SBP at any 2 values of joint_years;  */
/*  this essentially multiplies the beta by 10 */
/* 	estimate joint_years 10;  */

/* 	contrast 'Effect of increasing joint_years from 5 to 15' joint_years 10; */
	lsmeans joint_years / at = (joint_years = 5) (joint_years = 15) adjust=e;
&lt;/FONT&gt;
    format 
	race1c race1c.
	gender1	gender1f.
	income6 income6fmt.
	educ1 educ1fmt.
	htn_meds
	lipid_meds 
	dm_meds yes_no_fmt.
    ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks for your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Dec 2023 17:02:28 GMT</pubDate>
    <dc:creator>_maldini_</dc:creator>
    <dc:date>2023-12-04T17:02:28Z</dc:date>
    <item>
      <title>CONTRAST v. ESTIMATE statements - multivariable linear regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906062#M44968</link>
      <description>&lt;P&gt;I am running a multivariable linear regression and want to compare adjusted means of the&amp;nbsp;dependent variable (mean_sbp) at given values of the&amp;nbsp;independent variable (joint_years). Both variables are continuous. I am using proc glm for the regression. I want to be able to easily compare the adjusted mean_sbp at 5 joint_years to 15 joint_years. Or, compare the&amp;nbsp;mean_sbp of the median of joint_years to the 99th percentile of joint_years.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Googling and ChatGPT suggest using the&amp;nbsp;CONTRAST v. ESTIMATE statements, but I can't seem to figure it out.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I realize I could create categorical versions of&amp;nbsp;joint_years and use it as a categorical variable, but I'd like something a little more flexible.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are some approaches I have tried:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc mixed data=work.finallabel_6;
    class race1c gender1 income6 educ1 htn_meds lipid_meds dm_meds;
    model mean_sbp = joint_years race1c gender1 age6c income6 educ1 drinks_wk pkyrs6c pamvcm6c
                   bmi6c tchol_hdl_ratio hba1c6 glucose6 htn_meds lipid_meds dm_meds totmed6;
    
&lt;FONT color="#FF0000"&gt;    estimate 'Mean at joint_years=5' joint_years 1 / atmean joint_years=5;
    estimate 'Mean at joint_years=15' joint_years 1 / atmean joint_years=15;&lt;/FONT&gt;

    format 
    race1c race1c.
    gender1 gender1f.
    income6 income6fmt.
    educ1 educ1fmt.
    htn_meds
    lipid_meds 
    dm_meds yes_no_fmt.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glm data=mesa.finallabel_6;
	class race1c gender1 income6 educ1 htn_meds lipid_meds dm_meds; 
	
    model mean_sbp = joint_years race1c gender1 age6c income6 educ1 drinks_wk pkyrs6c pamvcm6c 
    bmi6c tchol_hdl_ratio hba1c6 glucose6 htn_meds lipid_meds dm_meds totmed6 / solution clparm;
    
&lt;FONT color="#FF0000"&gt;/*  estimate 'Difference at joint_years=0 vs joint_years=23' joint_years 1 -1; */

/* 	Use the estimate statement to compare the adjusted mean SBP at any 2 values of joint_years;  */
/*  this essentially multiplies the beta by 10 */
/* 	estimate joint_years 10;  */

/* 	contrast 'Effect of increasing joint_years from 5 to 15' joint_years 10; */
	lsmeans joint_years / at = (joint_years = 5) (joint_years = 15) adjust=e;
&lt;/FONT&gt;
    format 
	race1c race1c.
	gender1	gender1f.
	income6 income6fmt.
	educ1 educ1fmt.
	htn_meds
	lipid_meds 
	dm_meds yes_no_fmt.
    ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks for your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 17:02:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906062#M44968</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2023-12-04T17:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: CONTRAST v. ESTIMATE statements - multivariable linear regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906132#M44969</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008000"&gt;&lt;STRONG style="font-family: inherit;"&gt;Never use&amp;nbsp;ESTIMATE or CONTRAST statements when you can also achieve the wished for analyses by using&amp;nbsp;&lt;STRONG&gt;LSMEANS, SLICE, or LSMESTIMATE statements.&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If&amp;nbsp;ESTIMATE or CONTRAST statements cannot be avoided, take care because they are sometimes difficult to specify (program) correctly. Below are some blogs and usage notes on correct usage!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;The magical ESTIMATE (and CONTRAST) statements &lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;By Chris Daman on SAS Learning Post April 23, 2012&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sastraining/2012/04/23/the-magical-estimate-and-contrast-statements/" target="_blank"&gt;https://blogs.sas.com/content/sastraining/2012/04/23/the-magical-estimate-and-contrast-statements/&lt;/A&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;"Easy button" for ESTIMATE statements&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;By Chris Daman on SAS Learning Post April 25, 2012&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sastraining/2012/04/25/easy-button-for-estimate-statements/" target="_blank"&gt;https://blogs.sas.com/content/sastraining/2012/04/25/easy-button-for-estimate-statements/&lt;/A&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;ESTIMATE Statements - the final installment&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;By Chris Daman on SAS Learning Post May 2, 2012&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sastraining/2012/05/02/estimate-statements-the-final-installment/" target="_blank"&gt;https://blogs.sas.com/content/sastraining/2012/05/02/estimate-statements-the-final-installment/&lt;/A&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;How to write CONTRAST and ESTIMATE statements in SAS regression procedures?&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;By Rick Wicklin on The DO Loop June 6, 2016&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2016/06/06/write-contrast-estimate-statements-sas-regression-procedures.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2016/06/06/write-contrast-estimate-statements-sas-regression-procedures.html&lt;/A&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Usage Note 24447: Examples of writing CONTRAST and ESTIMATE statements&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/kb/24/447.html" target="_blank"&gt;https://support.sas.com/kb/24/447.html&lt;/A&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG style="font-family: inherit;"&gt;Usage Note 67024: Using the ESTIMATE or CONTRAST statement or Margins macro to assess continuous variable effects in interactions and splines&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/kb/67/024.html" target="_blank"&gt;67024 - Using the ESTIMATE or CONTRAST statement or Margins macro to assess continuous variable effects in interactions and splines (sas.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;When a model contains interactions, it is often of interest to assess the effect of one of the interacting variables. When the variable of interest is categorical, and therefore is specified in the CLASS statement, &lt;STRONG&gt;this is most easily done using the LSMEANS, SLICE, or LSMESTIMATE statement.&lt;/STRONG&gt; But when the variable of interest is continuous, these statements cannot be used. Two procedures, LOGISTIC and PHREG, provide statements that can estimate the effect of increasing a continuous predictor by a specified number of units. However, when the modeled response is not binomial or a time to event, these procedures are not appropriate. Nevertheless, the HAZARDRATIO statement in PROC PHREG can still be used to provide contrast coefficients that can be used in CONTRAST or ESTIMATE statements to test or estimate the effect of a continuous predictor. This can be done for a continuous predictor involved in one or more interactions and even in constructed effects such as splines. In the case of generalized linear models that don’t use the identity link, it is important to note that the estimated effect using these coefficients is not a difference in response means. For these models, an alternative and generally easier solution is provided by the Margins macro, which can estimate the required difference in means. Both of these approaches are discussed and illustrated in this note.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 21:46:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906132#M44969</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2023-12-04T21:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: CONTRAST v. ESTIMATE statements - multivariable linear regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906137#M44970</link>
      <description>&lt;P&gt;Thanks for the response and the helpful links.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you advise on how to use the&amp;nbsp;LSMEANS, SLICE, or LSMESTIMATE statements to achieve the desired result?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 22:02:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906137#M44970</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2023-12-04T22:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: CONTRAST v. ESTIMATE statements - multivariable linear regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906138#M44971</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are some example LSMEANS statements.&lt;BR /&gt;I think you can find inspiration in the 3 last ones (with &lt;STRONG&gt;at&lt;/STRONG&gt; and &lt;STRONG&gt;slice&lt;/STRONG&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;PROC MIXED : lsmeans adhesive / diff cl alpha=0.10;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;PROC MIXED : lsmeans pretrt stain / diff adjust=tukey adjdfe=row;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;PROC MIXED : lsmeans drug / diff=control('p') adjust=dunnett adjdfe=row;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;PROC MIXED : lsmeans Trt / e diff;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;PROC MIXED : lsmeans gender*age / slice=gender slice=age;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;PROC GLIMMIX : lsmeans trt / oddsratio ilink diff;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;PROC MIXED : lsmeans temp / at thick=1850 diff;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;PROC MIXED : lsmeans Trt / at flush0=50 diff;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;PROC MIXED : lsmeans drug*hour / slice=hour diff adjust=tukey adjdfe=row;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 22:15:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906138#M44971</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2023-12-04T22:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: CONTRAST v. ESTIMATE statements - multivariable linear regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906140#M44972</link>
      <description>&lt;P&gt;I don't think any of these are what the OP &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36911"&gt;@_maldini_&lt;/a&gt; wants, they all involve a class variable, and his original question was comparing the predicted values at two different values of a continuous variable, no class variable involved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I also don't think the question as stated by the OP makes any sense (yet) so I don't have an answer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;I am running a multivariable linear regression and want to compare adjusted means of the dependent variable (mean_sbp) at given values of the independent variable (joint_years). Both variables are continuous.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think instead of "adjusted means" the OP really means "predicted values" (am I right?), but there can be no predicted values unless you specify the values of the 7 CLASS variables, which hasn't been done (or even mentioned). Could you explain more about what you want?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, the OP says:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Googling and ChatGPT suggest using the CONTRAST v. ESTIMATE statements, but I can't seem to figure it out.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I am glad to hear this, I will mark this down as another case of ChatGPT not knowing enough to give a correct answer, but it gave an answer anyway.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 22:50:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906140#M44972</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-12-04T22:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: CONTRAST v. ESTIMATE statements - multivariable linear regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906143#M44973</link>
      <description>&lt;P&gt;Two ways depending on whether you compute the difference when all variables other than joint_years are fixed or you allow the other variables to use their observed values.&lt;/P&gt;
&lt;P&gt;1) As a difference in predicted response means at joint_years=5 and 15 at any fixed values for all the other variables. Use the ESTIMATE or CONTRAST statement in your GLM step to estimate the mean at joint_years=15 minus the mean at joint_years=5. The needed statement is simple since the model only involves main effects.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;estimate 'diff@15-5' joint_years -10;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2) As a difference of predictive margins at joint_years=5 and 15 using the &lt;A href="http://support.sas.com/kb/63038" target="_self"&gt;Margins macro&lt;/A&gt;. The predictive margins are computed as the averages of the predicted means fixed at joint_years=5 and 15 but allowing the other variables to use their actual values rather than restricting them to fixed values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mdat;
   do joint_years=15,5;
     output;
   end;
   run;
%margins(data=finallabel_6, 
         class=race1c gender1 income6 educ1 htn_meds lipid_meds dm_meds, 
         response=mean_sbp, 
         model=joint_years race1c gender1 age6c income6 educ1 drinks_wk pkyrs6c pamvcm6c
               bmi6c tchol_hdl_ratio hba1c6 glucose6 htn_meds lipid_meds dm_meds totmed6, 
         margins=joint_years, margindata=mdat, options=diff)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 23:13:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906143#M44973</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-12-04T23:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: CONTRAST v. ESTIMATE statements - multivariable linear regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906180#M44979</link>
      <description>&lt;P&gt;I don't understand. You just fixed a General Linear Model (only have fixed effect), the estimated coefficient (beta) of&amp;nbsp; "&lt;SPAN&gt;joint_years&amp;nbsp;&lt;/SPAN&gt;"&amp;nbsp; stands&amp;nbsp; for&amp;nbsp; one year(unit)&amp;nbsp; change of "&lt;SPAN&gt;joint_years&amp;nbsp;" wold make how much change of Y(mean_sbp&amp;nbsp;) .&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you want "compare the adjusted mean_sbp at 5 joint_years to 15 joint_years." , just multiple 10 with beta is what you are looking for .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For example:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc mixed data=sashelp.heart(obs=1000);
class sex bp_status status;
model weight=ageatstart height sex bp_status status /s ;



estimate 'diff@15-5' ageatstart 10;  /*&amp;lt;--suggested by @StatDave*/
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1701756805283.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/90785iD853C19690EF5DFB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1701756805283.png" alt="Ksharp_0-1701756805283.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;the beta of "AgeAtStart" is&amp;nbsp;0.2346 that stands for one year change of AgeAtStart would make&amp;nbsp;0.2346 change of "weight" . You just&amp;nbsp; &amp;nbsp;10*0.2346 = 2.346 is what you are looking for (the same result with StatDave suggested)?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 06:15:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906180#M44979</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-12-05T06:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: CONTRAST v. ESTIMATE statements - multivariable linear regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906273#M44989</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;You are correct. I am asking for predicted values of the dependent variable at values of the independent variable that I specify. Apologies for the confusion.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do I need to set reference categories for the variables in the CLASS statement? What about the continuous covariates?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 16:56:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906273#M44989</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2023-12-05T16:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: CONTRAST v. ESTIMATE statements - multivariable linear regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906275#M44990</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;Thanks. I have that syntax in my original post. It multiplies the beta by the number in the ESTIMATE statement, as you show. This is helpful, but it doesn't give me the adjusted means at 5 and 15 years (I now realize I used the wrong terminology in the original post. I'm looking for predicted values, as opposed to adjusted means).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 17:02:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906275#M44990</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2023-12-05T17:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: CONTRAST v. ESTIMATE statements - multivariable linear regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906276#M44991</link>
      <description>If you just want the difference in predicted means at 5 and 15, then you just need the ESTIMATE statement that I showed in my response earlier. If you want the predicted means, separately, at 5 and 15, then the easiest way (assuming that your data has observations observed at 5 and 15) is to add an OUTPUT statement in your PROC GLM step requesting predicted values:&lt;BR /&gt;&lt;BR /&gt;output out=mypreds pred=p;&lt;BR /&gt;&lt;BR /&gt;That will give you a data set MYPREDS with predicted means (in variable P) for each observation. See the ones where joint_years=5 or 15. Note that the predicted mean depends on the setting of all of the model variables, so they will vary.</description>
      <pubDate>Tue, 05 Dec 2023 17:10:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906276#M44991</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-12-05T17:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: CONTRAST v. ESTIMATE statements - multivariable linear regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906373#M45001</link>
      <description>&lt;P&gt;the following is what you are looking for ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc mixed data=sashelp.heart(obs=1000);
class sex bp_status status;
model weight=ageatstart height sex bp_status status /s ;

estimate 'adjusted mean of Y at year=5' intercept 1 ageatstart 5; 
estimate 'adjusted mean of Y at year=15' intercept 1 ageatstart 15; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1701830688852.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/90843i475578E042AE6DB0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1701830688852.png" alt="Ksharp_0-1701830688852.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As StatDave said, make a dataset to contains these predicted Y .&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc glm data=sashelp.heart(obs=1000);
class sex bp_status status;
model weight=ageatstart height sex bp_status status /solution ;

output out=mypreds PREDICTED=p;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Dec 2023 02:48:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/906373#M45001</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-12-06T02:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: CONTRAST v. ESTIMATE statements - multivariable linear regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/907623#M45066</link>
      <description>&lt;P data-unlink="true"&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13633"&gt;@StatDave&lt;/a&gt;&amp;nbsp;I'm exploring the macro approach, but I'm fairly naive to SAS macros. I read&amp;nbsp;&lt;A href="http://support.sas.com/kb/63/038.html" target="_self"&gt;the support article&lt;/A&gt;, and&amp;nbsp; downloaded&amp;nbsp;the Margins macro definition. When I run it with the data step you provided, I get the&amp;nbsp;Predictive Margins and the&amp;nbsp;Differences of Margins. Great.&lt;/P&gt;
&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-unlink="true"&gt;Just to confirm, if I wanted to compare the 95% percentile with the 50th percentile, for example, I would just replace the 5 and 15 in the DATA step with the values of the the 95% percentile with the 50th percentile, correct?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 18:04:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/907623#M45066</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2023-12-12T18:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: CONTRAST v. ESTIMATE statements - multivariable linear regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/907631#M45067</link>
      <description>&lt;P&gt;That is correct. You can put in any 2 or more values in the joint_years variable in the MDAT data set and the Margins macro will give all pairwise comparisons among those values. But as I noted earlier, predictive margins are computed differently from individual predicted values which change depending on the values of the other variables in the model. The predictive margin is the average of the predicted values from all of the observations with joint_years fixed at a given value.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 19:21:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/907631#M45067</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-12-12T19:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: CONTRAST v. ESTIMATE statements - multivariable linear regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/907946#M45073</link>
      <description>&lt;P&gt;&amp;lt;The predictive margin is the average of the predicted values from all of the observations with joint_years fixed at a given value.&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro description seems to indicate that for predictors not included in the margins= statement, mean values are used for&amp;nbsp;continuous variables and the reference level is used for categorical variables. And, there are ways to set these the values these predictors explicitly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I run the macro w/o setting any values, I get output that looks reasonable. I didn't&amp;nbsp;set the reference level for any variables in the CLASS statement, however. According to the documentation: "Individual variable options (such as REF=) are not supported.".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How would the macro know what the reference levels were?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How would I explicitly set the value of continuous predictors, if I wanted to?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again for all your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 21:19:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/907946#M45073</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2023-12-13T21:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: CONTRAST v. ESTIMATE statements - multivariable linear regression</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/907999#M45074</link>
      <description>The line you quoted is correct - read through the Details section of the Margins macro documentation for more info. Predictive margins do not generally set the values of all of the predictors other than specified in margins=. If you want all of the other predictors fixed, then you want predicted means, not predictive margins. You can get predicted means by simply using the PRED= option in the OUTPUT statement as I showed in my earlier reply. That will give you a data set with predicted means for all of your observations. If you want predicted means for other predictor settings than you have in your input data set, then create a data set with the desired predictor settings and then use the SCORE statement. See the example titled "Scoring data sets" in the LOGISTIC documentation.</description>
      <pubDate>Thu, 14 Dec 2023 13:48:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/CONTRAST-v-ESTIMATE-statements-multivariable-linear-regression/m-p/907999#M45074</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-12-14T13:48:34Z</dc:date>
    </item>
  </channel>
</rss>

