<?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: create dummy variables - Categorical Variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/442812#M110736</link>
    <description>&lt;P&gt;Code is pure text. Please DO NOT POST PICTURES OF CODE!!! Forcing people to type text from pictures is kind of rude.&lt;/P&gt;
&lt;P&gt;Use the proper buttons ("little running man" and {i}) to post code and logs or other fixed-space text.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Mar 2018 09:33:32 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-03-06T09:33:32Z</dc:date>
    <item>
      <title>create dummy variables - Categorical Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/442755#M110719</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have dataset "SAMPLE", contains a &lt;STRONG&gt;player&lt;/STRONG&gt; variable with records playerA, playerB,......... PlayerH, and &lt;STRONG&gt;country&lt;/STRONG&gt; variable with records countryA, countryB,.....countryF. I want to create dummy variables for each category in player and country&amp;nbsp;variables. If I go by writing general&amp;nbsp;&lt;STRONG&gt;IF-THEN&amp;nbsp;&lt;/STRONG&gt;statement it takes very long code to write. Please suggest me very simple code to create dummy variables for player, country variable and also i want to create interaction variable between player and country variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here sample dataset:&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="code.JPG" style="width: 273px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/19000iCEEF4B86C4B77492/image-size/large?v=v2&amp;amp;px=999" role="button" title="code.JPG" alt="code.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Expected output:&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="code1.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/19001i270A2730C962D6ED/image-size/large?v=v2&amp;amp;px=999" role="button" title="code1.JPG" alt="code1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;S Manoj&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 09:29:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/442755#M110719</guid>
      <dc:creator>s_manoj</dc:creator>
      <dc:date>2018-03-06T09:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: create dummy variables - Categorical Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/442783#M110727</link>
      <description>&lt;P&gt;Please supply example data in a data step with datalines, so we have data to work with.&lt;/P&gt;
&lt;P&gt;And show the expected result for that example dataset, so we can get a picture for the logical rule behind it.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 08:14:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/442783#M110727</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-06T08:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: create dummy variables - Categorical Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/442800#M110731</link>
      <description>&lt;P&gt;It's quite difficult to picture with the final result should look like.&amp;nbsp; Here's one possibility.&amp;nbsp; Perhaps you could comment about what you want, vs. what this does:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create table want as select * from sample, country;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 09:00:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/442800#M110731</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-06T09:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: create dummy variables - Categorical Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/442812#M110736</link>
      <description>&lt;P&gt;Code is pure text. Please DO NOT POST PICTURES OF CODE!!! Forcing people to type text from pictures is kind of rude.&lt;/P&gt;
&lt;P&gt;Use the proper buttons ("little running man" and {i}) to post code and logs or other fixed-space text.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 09:33:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/442812#M110736</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-06T09:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: create dummy variables - Categorical Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/442813#M110737</link>
      <description>&lt;P&gt;Before you go too far down this path, you should realize that SAS procedures often create both dummy variables and interaction terms as needed.&amp;nbsp; See if the procedure you intend to use supports the CLASS statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You run the risk of many complications here, including country names that contain multiple words, and player names that are too long to turn into a variable name.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 09:35:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/442813#M110737</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-06T09:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: create dummy variables - Categorical Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/442865#M110760</link>
      <description>&lt;P&gt;As other said ,post SAS CODE ,not picture, nobody would like to type it for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is very easy for IML code. But here is BASE code.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new;
input score player $ country $;
dummy=1;
cards;
10 A A
28 B B
87 C B
;
run;
proc logistic data=new outdesignonly outdesign=design;
class player country/param=glm;
model dummy=player country;
run;
data want;
 merge new(drop=dummy) design(drop=dummy intercept);
run;
proc print noobs;run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Mar 2018 13:04:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/442865#M110760</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-03-06T13:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: create dummy variables - Categorical Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/442872#M110762</link>
      <description>&lt;P&gt;Very long thread discussing many ways to create dummy variables&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/How-can-i-create-dummy-variables-How-can-i-change-my-code/m-p/404308#M66929" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/How-can-i-create-dummy-variables-How-can-i-change-my-code/m-p/404308#M66929&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Furthermore, if you are one the many modeling procedures in SAS, you don't need to create your own dummy variables anyway, this is all done internally in the procedure.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 13:34:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/442872#M110762</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-03-06T13:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: create dummy variables - Categorical Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/443210#M110865</link>
      <description>Thank you for code,&lt;BR /&gt;and I just want to know, within in this code is there any way to get the output with customized dummy variable name</description>
      <pubDate>Wed, 07 Mar 2018 08:34:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/443210#M110865</guid>
      <dc:creator>s_manoj</dc:creator>
      <dc:date>2018-03-07T08:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: create dummy variables - Categorical Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/443230#M110873</link>
      <description>&lt;P&gt;No. you can't. But you change variable name after getting DESIGN dataset.&lt;/P&gt;
&lt;P&gt;If you are using IML code, IML can do that.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 10:13:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-dummy-variables-Categorical-Variables/m-p/443230#M110873</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-03-07T10:13:05Z</dc:date>
    </item>
  </channel>
</rss>

