<?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: Creating dummy variable in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Creating-dummy-variable/m-p/448438#M69596</link>
    <description>&lt;P&gt;Thanks so much! I ended up using proc glm.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 24 Mar 2018 17:45:46 GMT</pubDate>
    <dc:creator>kthartma</dc:creator>
    <dc:date>2018-03-24T17:45:46Z</dc:date>
    <item>
      <title>Creating dummy variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-dummy-variable/m-p/446638#M69476</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a dummy variable for gender (m=0, f=1) so that I can use proc reg for a bivariate analyses. However, my error keeps indicating that my variable doesn't exist.&amp;nbsp;Any insight would be useful &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data eva.cohort;&lt;BR /&gt;set eva.finalcohort;&lt;/P&gt;&lt;P&gt;if sex="m" then sexm=0;&lt;/P&gt;&lt;P&gt;if sex="f" then sexf=1;&lt;BR /&gt;avgvol1=sum(avg_2009+avg_2011+avg_2012+avg_2014)/4;&lt;BR /&gt;avgvol2=sum(bee_avg_2009+bee_avg_2011+bee_avg_2012+bee_avg_2014)/4;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc means data=eva.cohort n nmiss mean median max min;&lt;/P&gt;&lt;P&gt;var avgvol1 avgvol2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc reg data=eva.cohort;&lt;/P&gt;&lt;P&gt;model avgvol1=sexm sexf;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Mar 2018 23:06:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-dummy-variable/m-p/446638#M69476</guid>
      <dc:creator>kthartma</dc:creator>
      <dc:date>2018-03-18T23:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Creating dummy variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-dummy-variable/m-p/446640#M69477</link>
      <description>&lt;P&gt;Perhaps your actual data doesn't contain "m" and "f".&amp;nbsp; Perhaps it contains "M" and "F" instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At any rate, you would be well advised to treat SEX as a CLASS variable within PROC REG.&amp;nbsp; Most regression procedures will automatically create the proper dummy variables when you use a CLASS statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note for the future:&amp;nbsp; instead of posting the program, post the log so we can see what message applies to what step.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Mar 2018 23:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-dummy-variable/m-p/446640#M69477</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-18T23:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating dummy variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-dummy-variable/m-p/446652#M69478</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt; wrote:
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At any rate, you would be well advised to treat SEX as a CLASS variable within PROC REG.&amp;nbsp; Most regression procedures will automatically create the proper dummy variables when you use a CLASS statement.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;PROC GLM, not PROC REG&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/190055"&gt;@kthartma&lt;/a&gt;: there is no need to create your own dummy variables. PROC GLM will create them for you, and also avoid the programming error you are having.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 00:46:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-dummy-variable/m-p/446652#M69478</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-03-19T00:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: Creating dummy variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-dummy-variable/m-p/446655#M69479</link>
      <description>&lt;P&gt;You're not using the SUM() function as usually intended&amp;nbsp;either.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's usually used when you want to consider missing as 0, this approach wouldn't do that because you've listed the items with + in between rather than comma's.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Test your code with the following:&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=" language-sas"&gt;avgvol1=sum(avg_2009+avg_2011+avg_2012+avg_2014)/4;

avgvol1_check0 =sum(avg_2009, avg_2011, avg_2012, avg_2014)/4;
avgvol1_check1 = sum(of avg_2009-avg_2014)/ 4;
avgvol1_check2 = mean(of avg_2009-avg_2014);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have different results between any of the calculations you have an issue.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 00:50:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-dummy-variable/m-p/446655#M69479</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-19T00:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: Creating dummy variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-dummy-variable/m-p/446669#M69480</link>
      <description>&lt;P&gt;If you insist on using proc reg your code should read:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data eva.cohort;
set eva.finalcohort;

if sex="m" then sexDum=0;
if sex="f" then sexDum=1;

avgvol1 = (avg_2009 + avg_2011 + avg_2012 + avg_2014) / 4;
avgvol2 = (bee_avg_2009 + bee_avg_2011 + bee_avg_2012 + bee_avg_2014) / 4;
run;

proc means data=eva.cohort n nmiss mean median max min;
var avgvol1 avgvol2;
run;

proc reg data=eva.cohort;
model avgvol1 = sexDum;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Mar 2018 03:45:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-dummy-variable/m-p/446669#M69480</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-03-19T03:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating dummy variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-dummy-variable/m-p/448438#M69596</link>
      <description>&lt;P&gt;Thanks so much! I ended up using proc glm.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Mar 2018 17:45:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-dummy-variable/m-p/448438#M69596</guid>
      <dc:creator>kthartma</dc:creator>
      <dc:date>2018-03-24T17:45:46Z</dc:date>
    </item>
  </channel>
</rss>

