<?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: Possible to create dummy variables with proc transpose? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235212#M12433</link>
    <description>&lt;P&gt;Slick, indeed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But be careful to look at your data before applying this technique. In general the levels of the categorical variables might not form valid SAS variable names. For example, if race="African American" or hospital="St. Mary's", then this automated&amp;nbsp;step will fail and you will need to write the RENAME= statements manually.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you do go with PGStats's automatied method, I suggest making the QUIT statement part of the CALL EXECUTE chain, as he originally suggested. I was confused by having the dangling QUIT at the end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;...&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; parm &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;end&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;=done;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;...&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; done &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; execute(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"quit;"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Nov 2015 12:58:57 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2015-11-18T12:58:57Z</dc:date>
    <item>
      <title>Possible to create dummy variables with proc transpose?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235140#M12420</link>
      <description>&lt;P&gt;Is it possible to&amp;nbsp;create dummy variables with proc transpose using the prefix option and id statement?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the prefix=race_ and prefix=hospital_&amp;nbsp;options and id statement, I've created the proper dummy variable names but I can't seem to assign the proper values to the new variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd like the following dataset:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test;
input membno race $ hospital $10.;
cards;
1 white capital
2 black capital
3 hispanic capital
4 asian capital
5 native stmary
6 white stmary
7 black stmary
;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To be transformed as follows:&lt;/P&gt;
&lt;PRE&gt;membno race_asian race_black race_hispanic race_native race_white hospital_capital hospital_stmary
1
2
3
4
5
6
7&lt;/PRE&gt;
&lt;P&gt;where each member #&amp;nbsp;is assigned the correct race and hospital with a value of some kind (for example, values of "." and " " in place of 1 and 0 would be fine).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 21:43:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235140#M12420</guid>
      <dc:creator>RobF</dc:creator>
      <dc:date>2015-11-17T21:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to create dummy variables with proc transpose?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235153#M12422</link>
      <description>&lt;P&gt;In your data step add a variable, either a one or a letter that is constant and use that in the VAR statement in your proc transpose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;Constant='X';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know that you can do both variables in a single proc transpose unfortunately.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 23:05:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235153#M12422</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-11-17T23:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to create dummy variables with proc transpose?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235158#M12423</link>
      <description>&lt;P&gt;Here is how to do this with proc glmmod :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc glmmod data=test outdesign=dum outparm=parm;
class race hospital;
model membno = race hospital;
run;

data _null_;
if _n_=1 then 
    call execute("data want; set dum; drop col1;");
set parm(firstobs=2) end=done;
call execute(cats("rename col",_colnum_,"=",effname,"_",race,hospital,";"));
if done then call execute("run;");
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Nov 2015 23:20:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235158#M12423</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-11-17T23:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to create dummy variables with proc transpose?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235168#M12428</link>
      <description>&lt;P&gt;Thanks Reeza - like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test;
input membno race $ hospital $10.;
constant=1;
cards;
1 white capital
2 black capital
3 hispanic capital
4 asian capital
5 native stmary
6 white stmary
7 black stmary
;
run;

proc sort data=test;
	by race;
run;
proc transpose data=test out=test_trans prefix=race_;
	by race;
	id race;
	var constant;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output dataset still isn't quite right, I'll fiddle around some more.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 02:26:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235168#M12428</guid>
      <dc:creator>RobF</dc:creator>
      <dc:date>2015-11-18T02:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to create dummy variables with proc transpose?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235169#M12429</link>
      <description>&lt;P&gt;Thanks PGStats, very slick!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 02:27:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235169#M12429</guid>
      <dc:creator>RobF</dc:creator>
      <dc:date>2015-11-18T02:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to create dummy variables with proc transpose?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235174#M12431</link>
      <description>&lt;P&gt;Added a few bells and whistles...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glmmod data=test outdesign=want outparm=parm noprint;
class race hospital;
model membno = race hospital / noint;
run;

data _null_;
if _n_=1 then 
    call execute("proc datasets noprint; modify want;");
set parm;
call execute(cats("label col", _colnum_, "='",
    propcase(effname), "=",
    propcase(race), propcase(hospital), "';"));
call execute(cats("rename col", _colnum_, "=", effname, "_",
    race, hospital, ";"));
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note: the quit; statement at the end terminates the datasets procedure inserted with the execute calls.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 03:37:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235174#M12431</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-11-18T03:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to create dummy variables with proc transpose?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235212#M12433</link>
      <description>&lt;P&gt;Slick, indeed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But be careful to look at your data before applying this technique. In general the levels of the categorical variables might not form valid SAS variable names. For example, if race="African American" or hospital="St. Mary's", then this automated&amp;nbsp;step will fail and you will need to write the RENAME= statements manually.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you do go with PGStats's automatied method, I suggest making the QUIT statement part of the CALL EXECUTE chain, as he originally suggested. I was confused by having the dangling QUIT at the end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;...&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; parm &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;end&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;=done;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;...&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; done &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; execute(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"quit;"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 12:58:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235212#M12433</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-11-18T12:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to create dummy variables with proc transpose?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235251#M12435</link>
      <description>&lt;P&gt;Agreed, good points.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm going to hold out on designating a correct&amp;nbsp;answer for a bit longer&amp;nbsp;&amp;amp; see if there's a sneaky way to use proc transpose to create the dummy variables.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 15:00:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235251#M12435</guid>
      <dc:creator>RobF</dc:creator>
      <dc:date>2015-11-18T15:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to create dummy variables with proc transpose?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235260#M12436</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No PROC TRANSPOSE solution, sorry.&lt;/P&gt;
&lt;P&gt;But with&amp;nbsp;PROC GLMSELECT (unlike GLMMOD) you get the right (design-) variable names immediatly (no renaming needed)!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;ods html close;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;ods preferences;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;ods html;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;glmselect&lt;/STRONG&gt; data=sashelp.prdsale namelen=&lt;STRONG&gt;50&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OUTDESIGN(ADDINPUTVARS FULLMODEL)=work.DesignVariables;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;class&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; country region division ProdType Product / param=reference ShowCoding split;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;model ACTUAL=country region division ProdType Product / /* STEPS=1 */ STOP=&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;output out=new;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;STRONG&gt;QUIT&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;/* end of program */&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fit an intercept-only model (you must build a dummy model to get the design variables)&amp;nbsp;for whatever target variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 15:22:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235260#M12436</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2015-11-18T15:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to create dummy variables with proc transpose?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235261#M12437</link>
      <description>&lt;P&gt;I think you'll be waiting a long time. PROC TRANSPOSE is not designed to create dummy variables.&amp;nbsp; It doesn't create new (0/1) data; it rearranges existing data.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 15:23:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235261#M12437</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-11-18T15:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to create dummy variables with proc transpose?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235283#M12440</link>
      <description>&lt;P&gt;Thank you Koen -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So running the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test;
input membno y race $ hospital $10.;
cards;
1 0 white capital
2 1 black capital
3 1 hispanic capital
4 0 asian capital
5 0 native stmary
6 1 white stmary
7 0 black stmary
;
run;

ods html close;
ods preferences;
ods html;
proc glmselect data=test namelen=50 OUTDESIGN(ADDINPUTVARS FULLMODEL)=work.DesignVariables;
	class race hospital / param=reference ShowCoding split;
	model y = / /* STEPS=1 */ STOP=1;
	output out=new;
run;
QUIT;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;should generate the dummy coded&amp;nbsp;variables in the "new" dataset, is that correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 16:05:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235283#M12440</guid>
      <dc:creator>RobF</dc:creator>
      <dc:date>2015-11-18T16:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to create dummy variables with proc transpose?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235290#M12442</link>
      <description>&lt;P&gt;Hello RobF,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You forgot to specify the categorical regressors (class variables) in the right hand side of the model equation.&lt;/P&gt;
&lt;P&gt;The dummy variables can be found in the dataset work.DesignVariables!! (I replaced new by _NULL_)&lt;/P&gt;
&lt;P&gt;Take care: for p categories you get only p-1 dummies (the alphabetically last class level has no dummy and a 0-value for the p-1 created dummies&amp;nbsp;= reference coding with default reference level). Maybe another parametrization scheme exists that does over-parametrization (p dummies for p categories as PROC GLM does)? You should have a look to the&amp;nbsp;possibilities of the param= option in the CLASS statement of PROC GLMSELECT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the corrected code:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;FONT color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;input&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; membno y race $ hospital &lt;FONT color="#008080"&gt;&lt;FONT color="#008080"&gt;&lt;FONT color="#008080"&gt;$10.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;cards&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;1 0 white capital&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;2 1 black capital&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;3 1 hispanic capital&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;4 0 asian capital&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;5 0 native stmary&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;6 1 white stmary&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;7 0 black stmary&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;FONT color="#000080"&gt;&lt;FONT color="#000080"&gt;&lt;FONT color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;ods&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;html&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;close&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;ods&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;preferences&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;ods&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;html&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;FONT color="#000080"&gt;&lt;FONT color="#000080"&gt;&lt;FONT color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080"&gt;&lt;FONT color="#000080"&gt;&lt;FONT color="#000080"&gt;glmselect&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;data&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;=test &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;namelen&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;=&lt;STRONG&gt;&lt;FONT color="#008080"&gt;&lt;FONT color="#008080"&gt;&lt;FONT color="#008080"&gt;50&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; OUTDESIGN(ADDINPUTVARS FULLMODEL)=work.DesignVariables;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;class&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; race hospital / &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;param&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;=reference &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;ShowCoding&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;split&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;model&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; y = race hospital / &lt;FONT color="#008000"&gt;&lt;FONT color="#008000"&gt;&lt;FONT color="#008000"&gt;/* STEPS=1 */&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;STOP&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;=&lt;STRONG&gt;&lt;FONT color="#008080"&gt;&lt;FONT color="#008080"&gt;&lt;FONT color="#008080"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;output&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;out&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;=_NULL_;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;FONT color="#000080"&gt;&lt;FONT color="#000080"&gt;&lt;FONT color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;FONT color="#000080"&gt;&lt;FONT color="#000080"&gt;&lt;FONT color="#000080"&gt;&lt;STRONG&gt;QUIT&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;/* end of program */&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 16:37:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235290#M12442</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2015-11-18T16:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to create dummy variables with proc transpose?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235291#M12443</link>
      <description>&lt;P&gt;Good to know, thanks! Playing with the code, it seems that good results are obtained with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc glmselect data=test namelen=50 noprint
    OUTDESIGN(FULLMODEL)=want;
class race hospital / param=glm;
model membno = race hospital / include=99 noint;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Nov 2015 16:37:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235291#M12443</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-11-18T16:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to create dummy variables with proc transpose?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235325#M12446</link>
      <description>&lt;P&gt;Thanks for the suggestions, gentlemen - now which response to declare as&amp;nbsp;the official solution?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any one of the solutions would be worth a presentation at the next World SAS Forum if it hasn't already been covered. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 18:03:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Possible-to-create-dummy-variables-with-proc-transpose/m-p/235325#M12446</guid>
      <dc:creator>RobF</dc:creator>
      <dc:date>2015-11-18T18:03:29Z</dc:date>
    </item>
  </channel>
</rss>

