<?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: Transforming column variable to rows with one ID per row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Transforming-column-variable-to-rows-with-one-ID-per-row/m-p/813548#M321098</link>
    <description>&lt;P&gt;How do you expect to use that resulting data set?&lt;/P&gt;
&lt;P&gt;Your use of "dummy variables" makes me think you may want to use this in some sort of regression. In which case why cause yourself work. Most of the regression procedures support CLASS variables which SAS will use the levels to create dummy variables for you. For most purposes the form of data you have is preferred.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or if you are looking for a report for people to read some thing like this perhaps:&lt;BR /&gt;Note use of DATA Step code to provide a usable data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
  infile datalines dsd dlm=' ';
  input ID Referral :$15.;
datalines;
1 Housing
1 Transportation
2 Food
3 Housing
3 Food
4 Transportation
4 "Mental Health"
;

proc tabulate data=have;
   class id referral;
   table id,
         referral*n=' '
         /misstext='0'
   ;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 16 May 2022 18:11:45 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-05-16T18:11:45Z</dc:date>
    <item>
      <title>Transforming column variable to rows with one ID per row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transforming-column-variable-to-rows-with-one-ID-per-row/m-p/813542#M321095</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to transform a column variable into several dummy variables with one row per ID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the data I have:&lt;/P&gt;&lt;P&gt;ID, Referral Type&lt;/P&gt;&lt;P&gt;1, Housing&lt;/P&gt;&lt;P&gt;1, Transportation&lt;/P&gt;&lt;P&gt;2, Food&lt;/P&gt;&lt;P&gt;3, Housing&lt;/P&gt;&lt;P&gt;3, Food&lt;/P&gt;&lt;P&gt;4, Transportation&lt;/P&gt;&lt;P&gt;4, Mental Health&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the data I want:&lt;/P&gt;&lt;P&gt;ID, Housing, Transportation, Food, Mental Health&lt;/P&gt;&lt;P&gt;1, 1, 1, 0, 0&lt;/P&gt;&lt;P&gt;2, 0, 0, 1, 0&lt;/P&gt;&lt;P&gt;3, 1, 0, 1, 0&lt;/P&gt;&lt;P&gt;4, 0, 1, 0, 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice would be greatly appreciated! Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 17:50:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transforming-column-variable-to-rows-with-one-ID-per-row/m-p/813542#M321095</guid>
      <dc:creator>love_epi</dc:creator>
      <dc:date>2022-05-16T17:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: Transforming column variable to rows with one ID per row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transforming-column-variable-to-rows-with-one-ID-per-row/m-p/813548#M321098</link>
      <description>&lt;P&gt;How do you expect to use that resulting data set?&lt;/P&gt;
&lt;P&gt;Your use of "dummy variables" makes me think you may want to use this in some sort of regression. In which case why cause yourself work. Most of the regression procedures support CLASS variables which SAS will use the levels to create dummy variables for you. For most purposes the form of data you have is preferred.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or if you are looking for a report for people to read some thing like this perhaps:&lt;BR /&gt;Note use of DATA Step code to provide a usable data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
  infile datalines dsd dlm=' ';
  input ID Referral :$15.;
datalines;
1 Housing
1 Transportation
2 Food
3 Housing
3 Food
4 Transportation
4 "Mental Health"
;

proc tabulate data=have;
   class id referral;
   table id,
         referral*n=' '
         /misstext='0'
   ;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 18:11:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transforming-column-variable-to-rows-with-one-ID-per-row/m-p/813548#M321098</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-05-16T18:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Transforming column variable to rows with one ID per row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transforming-column-variable-to-rows-with-one-ID-per-row/m-p/813703#M321169</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines dsd dlm=' ';
  input ID Referral $15.;
  var=1;
datalines;
1 Housing
1 Transportation
2 Food
3 Housing
3 Food
4 Transportation
4 Mental Health
;

proc transpose data=have out=temp(drop=_name_);
by id;
id Referral;
var var;
run;
proc stdize data=temp out=want missing=0 reponly;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 May 2022 06:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transforming-column-variable-to-rows-with-one-ID-per-row/m-p/813703#M321169</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-05-17T06:42:02Z</dc:date>
    </item>
  </channel>
</rss>

