<?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 dummies for character variables in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Create-dummies-for-character-variables/m-p/626957#M20466</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202889"&gt;@dapenDaniel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using the dummies for sum but great to know that SAS will handle the problem.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;PROC FREQ will tell you how many times each one appears.&lt;/P&gt;</description>
    <pubDate>Mon, 24 Feb 2020 18:39:07 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-02-24T18:39:07Z</dc:date>
    <item>
      <title>Create dummies for character variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-dummies-for-character-variables/m-p/626941#M20461</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a list of product name like below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input name $;
cards;
A1
A2
A5
B9
C2
C8;
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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create dummies for each of them. The data I want is as below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Name I1 I2 I3 I4 I5 I6&lt;/P&gt;&lt;P&gt;A1 1 0 0 0 0 0&lt;/P&gt;&lt;P&gt;A2 0 1 0 0 0 0&lt;/P&gt;&lt;P&gt;A5 0 0 1 0 0 0&lt;/P&gt;&lt;P&gt;B9 0 0 0 1 0 0&lt;/P&gt;&lt;P&gt;C2 0 0 0 0 1 0&lt;/P&gt;&lt;P&gt;C8 0 0 0 0 0 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what code do I need to use?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2020 18:14:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-dummies-for-character-variables/m-p/626941#M20461</guid>
      <dc:creator>dapenDaniel</dc:creator>
      <dc:date>2020-02-24T18:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create dummies for character variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-dummies-for-character-variables/m-p/626946#M20463</link>
      <description>&lt;P&gt;Here is one way.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Inspired by &lt;A href="https://blogs.sas.com/content/iml/2016/02/24/create-a-design-matrix-in-sas.html" target="_self"&gt;this article&lt;/A&gt; by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input name $;
cards;
A1
A2
A5
B9
C2
C8
;
run;

data temp / view=temp;
   set have;
   FakeY = 0;
run;

proc glmmod data=temp outdesign=design(drop=FakeY Col1) noprint;
   class name;
   model FakeY = name;
run;

data want;
   merge have design;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;name Col2 Col3 Col4 Col5 Col6 Col7 
A1   1    0    0    0    0    0 
A2   0    1    0    0    0    0 
A5   0    0    1    0    0    0 
B9   0    0    0    1    0    0 
C2   0    0    0    0    1    0 
C8   0    0    0    0    0    1 &lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Feb 2020 18:27:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-dummies-for-character-variables/m-p/626946#M20463</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-02-24T18:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Create dummies for character variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-dummies-for-character-variables/m-p/626950#M20464</link>
      <description>&lt;P&gt;Generally, creating your own dummy variables is unnecessary as most SAS modelling procedures handle character variables via the CLASS statement, and then the procedure creates the dummy variables so you don't have to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2020 18:31:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-dummies-for-character-variables/m-p/626950#M20464</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-24T18:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: Create dummies for character variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-dummies-for-character-variables/m-p/626954#M20465</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the dummies for sum but great to know that SAS will handle the problem.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2020 18:37:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-dummies-for-character-variables/m-p/626954#M20465</guid>
      <dc:creator>dapenDaniel</dc:creator>
      <dc:date>2020-02-24T18:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create dummies for character variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-dummies-for-character-variables/m-p/626957#M20466</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202889"&gt;@dapenDaniel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using the dummies for sum but great to know that SAS will handle the problem.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;PROC FREQ will tell you how many times each one appears.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2020 18:39:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-dummies-for-character-variables/m-p/626957#M20466</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-24T18:39:07Z</dc:date>
    </item>
  </channel>
</rss>

