<?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 Creating dummy variable using macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-dummy-variable-using-macro/m-p/317413#M69494</link>
    <description>&lt;P&gt;If I have a variable (var) such that if category= A then the value of var is 1, if category=B then value of var is 2, and if category =C then the value of var is 3 and I want to create indicator variables for these three categories of var, called var_1, var_2, and var_3 using macros, would it be correct to say&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macros Create_indictor (num=);&lt;/P&gt;&lt;P&gt;data= mydata;&lt;/P&gt;&lt;P&gt;if var= &amp;amp;num then %put var_&amp;amp;num;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend Create_indicator;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%Create_indicator (num=1);&lt;/P&gt;&lt;P&gt;%Create_indicator (num=2);&lt;/P&gt;&lt;P&gt;%Create_indicator (num=3);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Dec 2016 18:45:51 GMT</pubDate>
    <dc:creator>amajeau</dc:creator>
    <dc:date>2016-12-07T18:45:51Z</dc:date>
    <item>
      <title>Creating dummy variable using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-dummy-variable-using-macro/m-p/317413#M69494</link>
      <description>&lt;P&gt;If I have a variable (var) such that if category= A then the value of var is 1, if category=B then value of var is 2, and if category =C then the value of var is 3 and I want to create indicator variables for these three categories of var, called var_1, var_2, and var_3 using macros, would it be correct to say&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macros Create_indictor (num=);&lt;/P&gt;&lt;P&gt;data= mydata;&lt;/P&gt;&lt;P&gt;if var= &amp;amp;num then %put var_&amp;amp;num;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend Create_indicator;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%Create_indicator (num=1);&lt;/P&gt;&lt;P&gt;%Create_indicator (num=2);&lt;/P&gt;&lt;P&gt;%Create_indicator (num=3);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 18:45:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-dummy-variable-using-macro/m-p/317413#M69494</guid>
      <dc:creator>amajeau</dc:creator>
      <dc:date>2016-12-07T18:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Creating dummy variable using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-dummy-variable-using-macro/m-p/317415#M69496</link>
      <description>&lt;P&gt;Let's not reinvent the wheel &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS provides functionality to handle categorical variables, depending on your procedure.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you can use the methods here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2016/02/22/create-dummy-variables-in-sas.html" target="_blank"&gt;http://blogs.sas.com/content/iml/2016/02/22/create-dummy-variables-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At the bottom of this page there are three other links with ways to create dummy variables&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-dummy-variables-Categorical-Variables/ta-p/308484" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-dummy-variables-Categorical-Variables/ta-p/308484&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 18:51:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-dummy-variable-using-macro/m-p/317415#M69496</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-07T18:51:03Z</dc:date>
    </item>
  </channel>
</rss>

