<?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: Convert Clustered Counts to Dummy Coding in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-Clustered-Counts-to-Dummy-Coding/m-p/501172#M133598</link>
    <description>&lt;P&gt;Lol That's smart way to put the ball back in my court eh? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyways, Good morning and I will brb. However, I'd suggest you to hang in there if somebody who knows proc iml well might just get you robust solution&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Oct 2018 14:57:30 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-10-03T14:57:30Z</dc:date>
    <item>
      <title>Convert Clustered Counts to Dummy Coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Clustered-Counts-to-Dummy-Coding/m-p/501138#M133585</link>
      <description>&lt;P&gt;I would like to convert data that is currently represented as a series of counts to dummy coding.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following is similar to the data I have. However, the actual data has more organizations.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="492"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="86"&gt;Organization&lt;/TD&gt;
&lt;TD width="47"&gt;One_x&lt;/TD&gt;
&lt;TD width="54"&gt;two_x&lt;/TD&gt;
&lt;TD width="53"&gt;none_x&lt;/TD&gt;
&lt;TD width="50"&gt;total_x&lt;/TD&gt;
&lt;TD width="45"&gt;one_y&lt;/TD&gt;
&lt;TD width="54"&gt;two_y&lt;/TD&gt;
&lt;TD width="53"&gt;none_y&lt;/TD&gt;
&lt;TD width="50"&gt;total_y&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to reshape the above data to have the following representation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="290"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="86"&gt;Organization&lt;/TD&gt;
&lt;TD width="47"&gt;One_x&lt;/TD&gt;
&lt;TD width="54"&gt;two_x&lt;/TD&gt;
&lt;TD width="53"&gt;one_y&lt;/TD&gt;
&lt;TD width="50"&gt;two_y&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 14:02:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Clustered-Counts-to-Dummy-Coding/m-p/501138#M133585</guid>
      <dc:creator>PhillipSherlock</dc:creator>
      <dc:date>2018-10-03T14:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Clustered Counts to Dummy Coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Clustered-Counts-to-Dummy-Coding/m-p/501145#M133587</link>
      <description>&lt;P&gt;How do the none_x and total_x translate to the wanted table?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 14:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Clustered-Counts-to-Dummy-Coding/m-p/501145#M133587</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-10-03T14:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Clustered Counts to Dummy Coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Clustered-Counts-to-Dummy-Coding/m-p/501148#M133588</link>
      <description>&lt;P&gt;Individuals from the X and Y groups have either received "one", "two", or 'none". Total_X is equal to the sum of one_x, two_x, and none_x. Thee total number of rows should be equal to the sum of total_x and total_y. Please let me know if that answered your question.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 14:15:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Clustered-Counts-to-Dummy-Coding/m-p/501148#M133588</guid>
      <dc:creator>PhillipSherlock</dc:creator>
      <dc:date>2018-10-03T14:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Clustered Counts to Dummy Coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Clustered-Counts-to-Dummy-Coding/m-p/501167#M133595</link>
      <description>&lt;P&gt;Are the variable names in your sample good representative of your real ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason i am asking is because is it safe to take suffix _x for x groups and y groups respectively?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS if you can clarify at best, I will try my idea that I have in mind&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 14:53:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Clustered-Counts-to-Dummy-Coding/m-p/501167#M133595</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-03T14:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Clustered Counts to Dummy Coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Clustered-Counts-to-Dummy-Coding/m-p/501170#M133596</link>
      <description>If you can think of a way to make it work using those suffixes, then I will change the column names. Thank you for your help!</description>
      <pubDate>Wed, 03 Oct 2018 14:54:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Clustered-Counts-to-Dummy-Coding/m-p/501170#M133596</guid>
      <dc:creator>PhillipSherlock</dc:creator>
      <dc:date>2018-10-03T14:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Clustered Counts to Dummy Coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Clustered-Counts-to-Dummy-Coding/m-p/501172#M133598</link>
      <description>&lt;P&gt;Lol That's smart way to put the ball back in my court eh? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyways, Good morning and I will brb. However, I'd suggest you to hang in there if somebody who knows proc iml well might just get you robust solution&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 14:57:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Clustered-Counts-to-Dummy-Coding/m-p/501172#M133598</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-03T14:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Clustered Counts to Dummy Coding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Clustered-Counts-to-Dummy-Coding/m-p/501182#M133601</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Organization $	One_x	two_x	none_x	total_x	one_y	two_y	none_y	total_y;
cards;
A	1	2	1	4	1	1	1	3
;
data want;
if _n_=1 then do;
 dcl hash H () ;
   h.definekey  ('var') ;
   h.definedata ("value") ;
   h.definedone () ;
end;
set have(drop=total:);
array t(*) One_x--none_y;
do _n_=1 to dim(t);
var=vname(t(_n_));
value=t(_n_);
rc=h.add();
t(_n_)=0;
end;
call missing(var,value);
do _n_=1 to dim(t);
h.find(key:vname(t(_n_)));
	do j=1 to value;
	t(_n_)=scan(vname(t(_n_)),1,'_' ) ne 'none';
	output;
	end;
t(_n_)=0;
end;
h.clear();
drop rc value j var;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 15:21:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Clustered-Counts-to-Dummy-Coding/m-p/501182#M133601</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-03T15:21:47Z</dc:date>
    </item>
  </channel>
</rss>

