<?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 Re: Graphing with percentage values in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Graphing-with-percentage-values/m-p/815805#M40266</link>
    <description>&lt;P&gt;The code and the graph do not agree. The graph is for&amp;nbsp;"Negative Affective Responsivity" whereas the code creates a graph for&amp;nbsp;"Positive Affective Responsivity".&amp;nbsp; Furthermore, I cannot use your data because it contains user-defined formats that I do not have:&lt;/P&gt;
&lt;P&gt;ERROR: The format B1PAGE_F was not found or could not be loaded.&lt;BR /&gt;ERROR: The format B1PRSEXF was not found or could not be loaded.&lt;BR /&gt;ERROR: The format B1PA7CFF was not found or could not be loaded.&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regardless, the question is "percentage of WHAT?" Of the total range of the csrpa_mlm2 variable? If so, compute the MIN and MAX of&amp;nbsp;csrpa_mlm2 in the initial PROC MEANS step, then create new values at the mean +/- 1% of the range. For example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=JH.Final3;
  var csrpa_mlm2; 
  output out=out mean=mean std=sd min=Min max=Max;
run;

data mdat;
set out;
keep csrpa_mlm2;
P1 = 0.01 / (Max - Min);
do csrpa_mlm2 = mean-P1, mean, mean+P1;
   if csrpa_mlm2 = mean-P1 then csrpa_mlm2_Pct = -0.01;
   else if csrpa_mlm2 = mean+P1 then csrpa_mlm2_Pct = 0.01;
   else csrpa_mlm2_Pct = 0.0;
   output;
end;
format csrpa_mlm2_Pct PERCENT6.2;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Notice that instead of evaluating the model at&amp;nbsp;&lt;/P&gt;
&lt;P&gt;do csrpa_mlm2 = &lt;STRONG&gt;mean-sd, mean, mean+sd&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;this code evaluates the model at&lt;/P&gt;
&lt;P&gt;do csrpa_mlm2 = &lt;STRONG&gt;mean-P1, mean, mean+P1&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Since the model is linear, it shouldn't matter where you evaluate the model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To display percentages on the plot, use the&amp;nbsp;&lt;CODE class=" language-sas"&gt;csrpa_mlm2_Pct&lt;/CODE&gt;&amp;nbsp;as the X= variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is untested, but hopefully it will be helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jun 2022 19:11:52 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2022-06-01T19:11:52Z</dc:date>
    <item>
      <title>Graphing with percentage values</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Graphing-with-percentage-values/m-p/815418#M40252</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently have a simple PROC GLM where I am predicting levels of Norepinephrine (&lt;CODE class=""&gt;Norepinephrine&lt;/CODE&gt;) with stress reactivity (&lt;CODE class=""&gt;PAreactpost&lt;/CODE&gt;). I am using a continuous stress reactivity predictor variable in the main analysis model&amp;nbsp;(&lt;CODE class=""&gt;PAreactpost&lt;/CODE&gt;) but want to graph the results so that the figure shows the association between "norepinephrine" and&amp;nbsp; "percentage increases of stress reactivity." We are trying to do this so that it's easier to meaningfully interpret the results.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the syntax below, I am using MARGINS MACRO to graph the figure at 1-SD, Mean, 1+SD of the stress reactivity variable. If there is a way to change this to percentages, I would greatly appreciate your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc glm data= JH.Final3;format _all_;
model Norepinephrine = cage marriedMidus cHHtotalIncome Exercise20mins cChronCondNumb ClinicSex  EverSmokeReg  race_orig CNSmeds cCESD cBMI cAnyStressWide_sum  cNeuroticism pa_mlm2 PAreactpost;
run;quit;
******USING MACRO******;
ods pdf file="C:\Users\Daesik hong\Dropbox\@Norepinephrine paper &amp;amp; Affect Reactivity/PAReact.pdf";
proc means data=JH.Final3;
var cPAreactpost; 
output out=out mean=mean std=sd;
run;
data mdat;
set out;
keep cPAreactpost;
do cPAreactpost = mean-sd, mean, mean+sd;
output;
end;
run;
%Margins(data=JH.Final3, response=Norepinephrine, model=cage ClinicSex marriedmidus work race_orig  cedu cHHtotalIncome EverSmokeReg Exercise20mins CNSmeds cBMI cCESD cNeuroticism  cChronCondNumb  cAnyStressWide_sum pa_mlm2 cPAreactpost,
margins=cPAreactpost, margindata=mdat,
options=diff reverse cl)

proc sort data=_margins; 
by cPAreactpost;
run;

proc sgplot data=_margins noautolegend;
band upper=UPPER lower=LOWER x=cPAreactpost ;*/ transparency=.3;
series y=ESTIMATE x=cPAreactpost;
xaxis values=(-0.0627096 0 0.0627096) grid offsetmin=.05 offsetmax=.05
label="Positive Affective Responsivity";
yaxis values=(10 to 40  by 5) grid offsetmin=.05 offsetmax=.05 
label="Norepinephrine";
title "Effects of Positive Affective Responsivity on Norepinephrine";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 14:14:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Graphing-with-percentage-values/m-p/815418#M40252</guid>
      <dc:creator>Heejeong</dc:creator>
      <dc:date>2022-05-27T14:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Graphing with percentage values</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Graphing-with-percentage-values/m-p/815673#M40261</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;In the syntax below, I am using MARGINS MACRO to graph the figure at 1-SD, Mean, 1+SD of the stress reactivity variable. If there is a way to &lt;FONT color="#FF0000"&gt;change this to percentages&lt;/FONT&gt;, I would greatly appreciate your help.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm sorry, but I do not understand what you are trying to change to percentages. What does the word '&lt;FONT color="#FF0000"&gt;this&lt;/FONT&gt;' refer to?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you have not provided any data, perhaps you could upload the graph that you are currently getting and then tell us what part of the graph you want to change.&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 10:53:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Graphing-with-percentage-values/m-p/815673#M40261</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-05-30T10:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Graphing with percentage values</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Graphing-with-percentage-values/m-p/815732#M40263</link>
      <description>&lt;P&gt;Thank you so much for following up with my question, I definitely want to clarify my question if it was confusing!&lt;/P&gt;&lt;P&gt;&amp;nbsp;For clarification, I've attached several additional materials:&lt;/P&gt;&lt;P&gt;1. Macro Margins syntax, and the final dataset.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Syntax that generated the final figure.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc means data=JH.Final3;
var csrpa_mlm2; 
output out=out mean=mean std=sd;
run;
data mdat;
set out;
keep csrpa_mlm2;
do csrpa_mlm2 = mean-sd, mean, mean+sd;
output;
end;
run;
%Margins(data=JH.Final3, response=Norepinephrine, model=cage ClinicSex marriedmidus work race_orig  cedu cHHtotalIncome EverSmokeReg Exercise20mins CNSmeds cBMI cCESD cNeuroticism  cChronCondNumb  cAnyStressWide_sum cpa_mlm2 csrpa_mlm2,
margins=csrpa_mlm2, margindata=mdat,
options=diff reverse cl)

proc sort data=_margins; 
by csrpa_mlm2;
run;

proc sgplot data=_margins noautolegend;
band upper=UPPER lower=LOWER x=csrpa_mlm2 ;*/ transparency=.3;
series y=ESTIMATE x=csrpa_mlm2;
xaxis values=(-0.0627096 0 0.0627096) grid offsetmin=.05 offsetmax=.05
label="Positive Affective Responsivity";
yaxis values=(10 to 40  by 5) grid offsetmin=.05 offsetmax=.05 
label="Norepinephrine";
title "Effects of Positive Affective Responsivity on Norepinephrine";
run;&lt;/CODE&gt;&lt;/PRE&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;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Heejeong_0-1653930640823.png" style="width: 463px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71878i5B9C9AB8E3E86128/image-dimensions/463x347?v=v2" width="463" height="347" role="button" title="Heejeong_0-1653930640823.png" alt="Heejeong_0-1653930640823.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see the "Negative Affective Responsivity" is currently graphed at -1SD (which is -0.11 in the figure), Mean (which is 0 in the figure), and +1SD (which is 0.11 in the figure). I want to graph it so that Negative Affective Responsivity is graphed by percentage so that the interpretation could be that with X% increase of Negative Affective Responsivity, we see XX increase in levels of norepinephrine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there is anything else that's confusing, please let me know and I really appreciate your help!&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>Mon, 30 May 2022 18:20:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Graphing-with-percentage-values/m-p/815732#M40263</guid>
      <dc:creator>Heejeong</dc:creator>
      <dc:date>2022-05-30T18:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Graphing with percentage values</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Graphing-with-percentage-values/m-p/815805#M40266</link>
      <description>&lt;P&gt;The code and the graph do not agree. The graph is for&amp;nbsp;"Negative Affective Responsivity" whereas the code creates a graph for&amp;nbsp;"Positive Affective Responsivity".&amp;nbsp; Furthermore, I cannot use your data because it contains user-defined formats that I do not have:&lt;/P&gt;
&lt;P&gt;ERROR: The format B1PAGE_F was not found or could not be loaded.&lt;BR /&gt;ERROR: The format B1PRSEXF was not found or could not be loaded.&lt;BR /&gt;ERROR: The format B1PA7CFF was not found or could not be loaded.&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regardless, the question is "percentage of WHAT?" Of the total range of the csrpa_mlm2 variable? If so, compute the MIN and MAX of&amp;nbsp;csrpa_mlm2 in the initial PROC MEANS step, then create new values at the mean +/- 1% of the range. For example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=JH.Final3;
  var csrpa_mlm2; 
  output out=out mean=mean std=sd min=Min max=Max;
run;

data mdat;
set out;
keep csrpa_mlm2;
P1 = 0.01 / (Max - Min);
do csrpa_mlm2 = mean-P1, mean, mean+P1;
   if csrpa_mlm2 = mean-P1 then csrpa_mlm2_Pct = -0.01;
   else if csrpa_mlm2 = mean+P1 then csrpa_mlm2_Pct = 0.01;
   else csrpa_mlm2_Pct = 0.0;
   output;
end;
format csrpa_mlm2_Pct PERCENT6.2;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Notice that instead of evaluating the model at&amp;nbsp;&lt;/P&gt;
&lt;P&gt;do csrpa_mlm2 = &lt;STRONG&gt;mean-sd, mean, mean+sd&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;this code evaluates the model at&lt;/P&gt;
&lt;P&gt;do csrpa_mlm2 = &lt;STRONG&gt;mean-P1, mean, mean+P1&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Since the model is linear, it shouldn't matter where you evaluate the model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To display percentages on the plot, use the&amp;nbsp;&lt;CODE class=" language-sas"&gt;csrpa_mlm2_Pct&lt;/CODE&gt;&amp;nbsp;as the X= variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is untested, but hopefully it will be helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 19:11:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Graphing-with-percentage-values/m-p/815805#M40266</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-06-01T19:11:52Z</dc:date>
    </item>
  </channel>
</rss>

