<?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: DO LOOP for summarizing a variable per multiple ID entries in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/DO-LOOP-for-summarizing-a-variable-per-multiple-ID-entries/m-p/327479#M73061</link>
    <description>&lt;P&gt;An interesting smart way to think through it, that is simple! thanks!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Jan 2017 18:26:45 GMT</pubDate>
    <dc:creator>lillymaginta</dc:creator>
    <dc:date>2017-01-25T18:26:45Z</dc:date>
    <item>
      <title>DO LOOP for summarizing a variable per multiple ID entries</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-LOOP-for-summarizing-a-variable-per-multiple-ID-entries/m-p/327469#M73057</link>
      <description>&lt;P&gt;I have the following data:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;id s1 m1 t1 
1 1   0    0
1 1 1     0
1 1 0    0
2 1 0 1
2  0 1 0&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want to create a dataset that if the value of each of the three variables s1, m1, t1 was once "1" then outpuet&amp;nbsp;"1" row for that id that represent either a 0 or 1 for each id.&amp;nbsp;&lt;/P&gt;&lt;P&gt;output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;id m1 s1 t1 
1 1   1    0
2  1   1   1&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Jan 2017 18:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-LOOP-for-summarizing-a-variable-per-multiple-ID-entries/m-p/327469#M73057</guid>
      <dc:creator>lillymaginta</dc:creator>
      <dc:date>2017-01-25T18:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: DO LOOP for summarizing a variable per multiple ID entries</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-LOOP-for-summarizing-a-variable-per-multiple-ID-entries/m-p/327475#M73058</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/72105"&gt;@lillymaginta&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I have the following data:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;id s1 m1 t1 
1 1   0    0
1 1 1     0
1 1 0    0
2 1 0 1
2  0 1 0&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I want to create a dataset that if the value of each of the three variables s1, m1, t1 was once "1" then outpuet&amp;nbsp;"1" row for that id that represent either a 0 or 1 for each id.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;id m1 s1 t1 
1 1   1    0
2  1   1   1&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It looks to me like you want the max of M1 S1 and T1 for each ID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data s;
   input id s1 m1 t1;
   cards;
1 1   0    0
1 1 1     0
1 1 0    0
2 1 0 1
2  0 1 0
;;;;
   run;
proc print;
   run;
proc summary data=s nway;
   class id;
   output out=max(drop=_:) max(s1 m1 t1)=;
   run;
proc print;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;IMG title="Capture.PNG" alt="Capture.PNG" src="https://communities.sas.com/t5/image/serverpage/image-id/6885i003AA26E48B5369E/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 18:17:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-LOOP-for-summarizing-a-variable-per-multiple-ID-entries/m-p/327475#M73058</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2017-01-25T18:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: DO LOOP for summarizing a variable per multiple ID entries</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-LOOP-for-summarizing-a-variable-per-multiple-ID-entries/m-p/327478#M73060</link>
      <description>&lt;P&gt;data have ;&lt;BR /&gt;input id s1 m1 t1; &lt;BR /&gt;cards;&lt;BR /&gt;1 1&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;BR /&gt;1 1 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;BR /&gt;1 1 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;BR /&gt;2 1 0 1&lt;BR /&gt;2&amp;nbsp; 0 1 0&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;options missing=0;&lt;BR /&gt;data want ;&lt;BR /&gt;set have(rename=(s1=s2 m1=m2 t1=t2));&lt;BR /&gt;by id;&lt;BR /&gt;retain s1 m1 t1;&lt;BR /&gt;if first.id then do;&lt;BR /&gt;s1=.;&lt;BR /&gt;m1=.;&lt;BR /&gt;t1=.;&lt;BR /&gt;end;&lt;BR /&gt;if s2 eq 1 then s1=s2;&lt;BR /&gt;if m2 eq 1 then m1=m2;&lt;BR /&gt;if t2 eq 1 then t1=t2;&lt;BR /&gt;if last.id;&lt;BR /&gt;drop s2 m2 t2;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 18:25:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-LOOP-for-summarizing-a-variable-per-multiple-ID-entries/m-p/327478#M73060</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-01-25T18:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: DO LOOP for summarizing a variable per multiple ID entries</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-LOOP-for-summarizing-a-variable-per-multiple-ID-entries/m-p/327479#M73061</link>
      <description>&lt;P&gt;An interesting smart way to think through it, that is simple! thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 18:26:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-LOOP-for-summarizing-a-variable-per-multiple-ID-entries/m-p/327479#M73061</guid>
      <dc:creator>lillymaginta</dc:creator>
      <dc:date>2017-01-25T18:26:45Z</dc:date>
    </item>
  </channel>
</rss>

