<?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 create dummy variables - Categorical Variables in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-create-dummy-variables-Categorical-Variables/m-p/258766#M13688</link>
    <description>&lt;P&gt;Here are some articles about how to create dummy variables in SAS. They contain discussion and examples:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://blogs.sas.com/content/iml/2016/02/22/create-dummy-variables-in-sas.html" target="_self"&gt;Create dummy variables in SAS&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.sas.com/content/iml/2016/02/24/create-a-design-matrix-in-sas.html" target="_self"&gt;Four ways to create a design matrix in SAS&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.sas.com/content/iml/2016/03/02/dummy-variables-sasiml.html" target="_self"&gt;Dummy variables in SAS/IML&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;A design matrix is a numeric matrix that representes all variables (continuous and categorical) in a regression model.&lt;/P&gt;</description>
    <pubDate>Thu, 24 Mar 2016 09:55:55 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2016-03-24T09:55:55Z</dc:date>
    <item>
      <title>How to create dummy variables - Categorical Variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-create-dummy-variables-Categorical-Variables/m-p/258702#M13685</link>
      <description>&lt;P&gt;If you're doing some analysis with categorical data and you're using a proc that does not support the CLASS statement then you may need to create dummy variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I won't go into what dummy variables are, but how to create them using GLMMOD.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Problem: Create dummy variables for sex and age from sashelp.class dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Solution:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Run model within PROC GLMMOD for it to create design matrix
Include all variables that might be in the model*/
proc glmmod data=sashelp.class outdesign=want outparm=p;
class sex age;
model weight = sex age height;
run;

/*Create rename statement automatically
THIS WILL NOT WORK IF YOUR VARIABLE NAMES WILL END UP OVER 32 CHARS*/
data p;
set p;
if _n_=1 and effname='Intercept' then var='Col1=Intercept';
else var= catt("Col", _colnum_, "=", catx("_", effname, vvaluex(effname)));
run;

proc sql;
select var into :rename_list separated by " "
from p;
quit;


/*Rename variables*/
proc datasets library=work nodetails nolist;
modify want;
rename &amp;amp;rename_list;
run;quit;


proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The WANT dataset can now be used to model with the dummy variables present.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 01:46:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-create-dummy-variables-Categorical-Variables/m-p/258702#M13685</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-24T01:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dummy variables - Categorical Variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-create-dummy-variables-Categorical-Variables/m-p/258766#M13688</link>
      <description>&lt;P&gt;Here are some articles about how to create dummy variables in SAS. They contain discussion and examples:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://blogs.sas.com/content/iml/2016/02/22/create-dummy-variables-in-sas.html" target="_self"&gt;Create dummy variables in SAS&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.sas.com/content/iml/2016/02/24/create-a-design-matrix-in-sas.html" target="_self"&gt;Four ways to create a design matrix in SAS&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.sas.com/content/iml/2016/03/02/dummy-variables-sasiml.html" target="_self"&gt;Dummy variables in SAS/IML&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;A design matrix is a numeric matrix that representes all variables (continuous and categorical) in a regression model.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 09:55:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-create-dummy-variables-Categorical-Variables/m-p/258766#M13688</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-03-24T09:55:55Z</dc:date>
    </item>
  </channel>
</rss>

