<?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: How to use a dummy or indicator variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-dummy-or-indicator-variable/m-p/531744#M145606</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set brand;
   if sweetness=2 then dummy=1;
   else if sweetness=4 then dummy=0;
   else;
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 31 Jan 2019 17:57:28 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-01-31T17:57:28Z</dc:date>
    <item>
      <title>How to use a dummy or indicator variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-dummy-or-indicator-variable/m-p/531741#M145603</link>
      <description>&lt;P&gt;How do I create a dummy or indicator variable for "sweetness" variable for the data below? Say use 1="2" and 0="4"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data brand;
	input preference moisturecontent sweetness @@;
	datalines;
	64 4 2 73 4 4 61 4 2 76 4 4 72 6 2 80 6 4 
	71 6 2 83 6 4 83 8 2 89 8 4 86 8 2 93 8 4
	88 10 2 95 10 4 94 10 2 100 10 4
	;
run;
proc print;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Jan 2019 17:54:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-dummy-or-indicator-variable/m-p/531741#M145603</guid>
      <dc:creator>JUMMY</dc:creator>
      <dc:date>2019-01-31T17:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a dummy or indicator variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-dummy-or-indicator-variable/m-p/531743#M145605</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data brand;
	input preference moisturecontent sweetness @@;
	datalines;
	64 4 2 73 4 4 61 4 2 76 4 4 72 6 2 80 6 4 
	71 6 2 83 6 4 83 8 2 89 8 4 86 8 2 93 8 4
	88 10 2 95 10 4 94 10 2 100 10 4
	;
run;

data dummy;
set brand;
indicator_sweet=sweetness=2;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Jan 2019 17:57:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-dummy-or-indicator-variable/m-p/531743#M145605</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-31T17:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a dummy or indicator variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-dummy-or-indicator-variable/m-p/531744#M145606</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set brand;
   if sweetness=2 then dummy=1;
   else if sweetness=4 then dummy=0;
   else;
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Jan 2019 17:57:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-dummy-or-indicator-variable/m-p/531744#M145606</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-01-31T17:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a dummy or indicator variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-dummy-or-indicator-variable/m-p/531754#M145613</link>
      <description>&lt;P&gt;So, I am certainly reading between the lines here, but it seems to me that you have asked the wrong question, and the answers you received don't steer you any closer to a better solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226541"&gt;@JUMMY&lt;/a&gt;&amp;nbsp;you have asked a huge number of questions here in this forum about modeling in SAS. So why would you need dummy variables? You probably don't. Almost every SAS modeling procedure does not need dummy variables to be&amp;nbsp; created before you do the modeling. The SAS procedures have a CLASS statement, which does the unpleasant and tedious work of creating dummy variables for you. So, bottom line, don't create the dummy variables yourself if you are modeling in almost every SAS modeling procedure, use the CLASS statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next topic:&lt;/P&gt;
&lt;P&gt;So ... not reading between the lines here ... again, I'm not happy with the answers you received ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;How do I create a dummy or indicator variable for "sweetness" variable for the data below? Say use 1="2" and 0="4"?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Generally, there's no reason to do this either. You don't need dummy variables. You already have two "class" levels, "2" and "4". Converting to zeros and ones is just extra work that provides no benefit if you are going to treat them as categories.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 18:49:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-dummy-or-indicator-variable/m-p/531754#M145613</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-31T18:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a dummy or indicator variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-dummy-or-indicator-variable/m-p/531755#M145614</link>
      <description>&lt;P&gt;Bingo!!!&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 18:49:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-dummy-or-indicator-variable/m-p/531755#M145614</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-31T18:49:58Z</dc:date>
    </item>
  </channel>
</rss>

