<?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 PROC REG SGPLOT while adjusting for covariates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-REG-SGPLOT-while-adjusting-for-covariates/m-p/839537#M331943</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using PROC SGPLOT to produce a scatterplot that depicts a linear relationship between a continuous predictor and a&amp;nbsp;continuous outcome with a linear fit line and a surrounding 95% confidence interval. The code is below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=mydata NOAUTOLEGEND;
reg x=Predictor y=Outcome / 
filledoutlinedmarkers markerfillattrs=(color=white) 
markeroutlineattrs=(color=black) 
markerattrs=(symbol=circlefilled size=7)
lineattrs=(pattern=SOLID thickness=2 color=black) 
clm clmattrs=(clmfillattrs=(color=gray transparency=.3));
xaxis values = (0 to 3 by .5) 
label='Predictor'
LABELATTRS=(size=20 weight=bold) 
VALUEATTRS=(size=18 weight=bold);
yaxis grid values = (0 to 4 by .5) 
label='Outcome' 
LABELATTRS=(size=20 weight=bold)
VALUEATTRS=(size=18 weight=bold) 
GRIDATTRS=(color=GrayCA thickness=.0mm);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This produces a plot depicting a simple linear regression. The issue is that my analyses include not only a predictor and an outcome, but also covariates such as sex and income. Is there some way to produce a scatterplot that depicts a relationship between a predictor and outcome while adjusting for several covariates? [I'd prefer not to share any data for privacy reasons.]&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Oct 2022 23:02:34 GMT</pubDate>
    <dc:creator>confooseddesi89</dc:creator>
    <dc:date>2022-10-19T23:02:34Z</dc:date>
    <item>
      <title>PROC REG SGPLOT while adjusting for covariates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-REG-SGPLOT-while-adjusting-for-covariates/m-p/839537#M331943</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using PROC SGPLOT to produce a scatterplot that depicts a linear relationship between a continuous predictor and a&amp;nbsp;continuous outcome with a linear fit line and a surrounding 95% confidence interval. The code is below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=mydata NOAUTOLEGEND;
reg x=Predictor y=Outcome / 
filledoutlinedmarkers markerfillattrs=(color=white) 
markeroutlineattrs=(color=black) 
markerattrs=(symbol=circlefilled size=7)
lineattrs=(pattern=SOLID thickness=2 color=black) 
clm clmattrs=(clmfillattrs=(color=gray transparency=.3));
xaxis values = (0 to 3 by .5) 
label='Predictor'
LABELATTRS=(size=20 weight=bold) 
VALUEATTRS=(size=18 weight=bold);
yaxis grid values = (0 to 4 by .5) 
label='Outcome' 
LABELATTRS=(size=20 weight=bold)
VALUEATTRS=(size=18 weight=bold) 
GRIDATTRS=(color=GrayCA thickness=.0mm);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This produces a plot depicting a simple linear regression. The issue is that my analyses include not only a predictor and an outcome, but also covariates such as sex and income. Is there some way to produce a scatterplot that depicts a relationship between a predictor and outcome while adjusting for several covariates? [I'd prefer not to share any data for privacy reasons.]&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 23:02:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-REG-SGPLOT-while-adjusting-for-covariates/m-p/839537#M331943</guid>
      <dc:creator>confooseddesi89</dc:creator>
      <dc:date>2022-10-19T23:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REG SGPLOT while adjusting for covariates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-REG-SGPLOT-while-adjusting-for-covariates/m-p/839543#M331946</link>
      <description>&lt;P&gt;Use the predicted values from PROC REG in your SGPLOT scatterplot. I believe, if I am understanding you properly, you will have to pick a specific value of the covariate in order to get a predicted value; you could plot the predicted values for several different values of the covariate in SGPLOT, that might help show how the line changes as the covariate changes.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 23:25:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-REG-SGPLOT-while-adjusting-for-covariates/m-p/839543#M331946</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-10-19T23:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REG SGPLOT while adjusting for covariates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-REG-SGPLOT-while-adjusting-for-covariates/m-p/839609#M331962</link>
      <description>It looks like you want " partial correlation coefficient" . &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt; wrote blogs about this :&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2022/06/20/partial-leverage-plots.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2022/06/20/partial-leverage-plots.html&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2022/07/11/confidence-bands-partial-leverage-plot.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2022/07/11/confidence-bands-partial-leverage-plot.html&lt;/A&gt;</description>
      <pubDate>Thu, 20 Oct 2022 11:42:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-REG-SGPLOT-while-adjusting-for-covariates/m-p/839609#M331962</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-10-20T11:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REG SGPLOT while adjusting for covariates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-REG-SGPLOT-while-adjusting-for-covariates/m-p/839990#M332124</link>
      <description>&lt;P&gt;Excellent, thank you. That is the plot I was looking for. For those who are interested, here is how I produced the partial plot with 95% confidence interval:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/***Run linear regression analysis with covariates &amp;amp; produce partial dataset***/
Proc reg data=mydata plots(only)=PartialPlot;
model Outcome=Predictor Covariate1 Covariate2 / VIF clb stb partial partialdata;
ods exclude PartialPlotData;
ods output PartialPlotData=partialdata;quit;run;

/*Obtain means of predictor and outcome in main data*/
proc means data=mydata mean; 
var Predictor Outcome;run;
/*create non-mean centered Predictor and Outcome in partial data*/
data partialdata; set partialdata;
Predictor=part_Predictor+[mean of predictor];
Outcome= part_Outcome_Predictor+[mean of outcome];run;
/**generate plot**/
proc sort data=partialdata; by Predictor;run;
proc sgplot data=partialdata NOAUTOLEGEND;
reg x=Predictor y=Outcome / 
filledoutlinedmarkers markerfillattrs=(color=white) 
markeroutlineattrs=(color=black) 
markerattrs=(symbol=circlefilled size=7)
lineattrs=(pattern=SOLID thickness=2 color=black) 
clm clmattrs=(clmfillattrs=(color=gray transparency=.3));
xaxis values = (.5 to 2.5 by .5) 
label='Predictor'
LABELATTRS=(size=20 weight=bold) 
VALUEATTRS=(size=18 weight=bold);
yaxis grid values = (1.5 to 2.5 by .25) 
label='Outcome' 
LABELATTRS=(size=20 weight=bold)
VALUEATTRS=(size=18 weight=bold) 
GRIDATTRS=(color=GrayCA thickness=.0mm);run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Oct 2022 17:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-REG-SGPLOT-while-adjusting-for-covariates/m-p/839990#M332124</guid>
      <dc:creator>confooseddesi89</dc:creator>
      <dc:date>2022-10-21T17:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REG SGPLOT while adjusting for covariates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-REG-SGPLOT-while-adjusting-for-covariates/m-p/839992#M332126</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/275602"&gt;@confooseddesi89&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am going to have to disagree with the use of PARTIALDATA&amp;nbsp; here. It doesn't seem to fit the requirements you stated above, which was to plot the predicted values in the presence of a covariate. The PARTIALDATA plots the leverage, as stated in the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_reg_syntax08.htm#statug.reg.modelpartialdata" target="_self"&gt;PROC REG documentation&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN class=" aa-term "&gt;PARTIALDATA&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;requests partial regression leverage data for each regressor. You can&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A id="statug.reg.a0000000164" class="indexterm" target="_blank"&gt;&lt;/A&gt;&lt;A id="statug.reg.a0000000165" class="indexterm" target="_blank"&gt;&lt;/A&gt;request partial regression leverage plots of these data with the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A tabindex="0" href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_reg_syntax08.htm#statug.reg.modelpartial" target="_blank"&gt;PARTIAL&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;option. See the section&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A tabindex="0" href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_reg_details26.htm" target="_blank"&gt;Influence Statistics&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for more information.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 17:51:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-REG-SGPLOT-while-adjusting-for-covariates/m-p/839992#M332126</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-10-21T17:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REG SGPLOT while adjusting for covariates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-REG-SGPLOT-while-adjusting-for-covariates/m-p/840016#M332139</link>
      <description>&lt;P&gt;Hi PaigeMiller,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to the documentation, "For a given regressor, the partial regression leverage plot is the plot of the dependent variable and the regressor after they have been made orthogonal to the other regressors in the model." This appears to be what I desired. Indeed, the slope of the line in the partial plot is identical to the coefficient produced in the adjusted model. Perhaps I explained my desired plot incorrectly. Thanks for your answer nonetheless.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 20:20:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-REG-SGPLOT-while-adjusting-for-covariates/m-p/840016#M332139</guid>
      <dc:creator>confooseddesi89</dc:creator>
      <dc:date>2022-10-21T20:20:03Z</dc:date>
    </item>
  </channel>
</rss>

