<?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 do I identify multiple records within a row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-identify-multiple-records-within-a-row/m-p/714676#M220668</link>
    <description>&lt;P&gt;First identify which group a record belongs to and then you can determine later how to summarize them separately. You don't indicate how that would work so I'm guessing. It would have also been really helpful to see what you expect as output from this input. If my solution doesn't work, please post what you expect as output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set test;

if sum(weight, height, income)&amp;gt;1 then group = "2";
else group = "1";

run;

proc freq data=want;
table group;
table group*name / list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/253321"&gt;@CathyVI&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have to following synthetic data similar to my data. I have millions of records so this is demo I created.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Name $ sex $ weight height income;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;cards&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Bob M 1 0 0&lt;/P&gt;
&lt;P&gt;Mat M 0 1 0&lt;/P&gt;
&lt;P&gt;Cat F 1 0 1&lt;/P&gt;
&lt;P&gt;Dog F 1 0 0&lt;/P&gt;
&lt;P&gt;Fred M 0 1 1&lt;/P&gt;
&lt;P&gt;Sam M 0 0 1&lt;/P&gt;
&lt;P&gt;Pat F 0 0 0&lt;/P&gt;
&lt;P&gt;Jack M 1 1 1&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;My goal is to identify when a row has more than 1 record&amp;nbsp;within the variable weight, height and income.&lt;/P&gt;
&lt;P&gt;For example the cat, fred and jack rows all have 1 record for each variable, how will I find these values. I want to&amp;nbsp;identify row with more than 1 record separately from&amp;nbsp;row with only 1 record.&lt;/P&gt;
&lt;P&gt;So I want the count of cat, fred and jack separately and the count of bob, mat, dog, sam separately. I already identify the latter using this code;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data check;&lt;/P&gt;
&lt;P&gt;set test;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Arial" size="3"&gt;if &lt;/FONT&gt;weight&amp;nbsp;=1 or&amp;nbsp;height =1 or&amp;nbsp;income=1 then total_all=1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;else total_all=0;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jan 2021 17:19:29 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-01-27T17:19:29Z</dc:date>
    <item>
      <title>How do I identify multiple records within a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-identify-multiple-records-within-a-row/m-p/714672#M220664</link>
      <description>&lt;P&gt;I have to following synthetic data similar to my data. I have millions of records so this is demo I created.&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Name $ sex $ weight height income;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;cards&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Bob M 1 0 0&lt;/P&gt;&lt;P&gt;Mat M 0 1 0&lt;/P&gt;&lt;P&gt;Cat F 1 0 1&lt;/P&gt;&lt;P&gt;Dog F 1 0 0&lt;/P&gt;&lt;P&gt;Fred M 0 1 1&lt;/P&gt;&lt;P&gt;Sam M 0 0 1&lt;/P&gt;&lt;P&gt;Pat F 0 0 0&lt;/P&gt;&lt;P&gt;Jack M 1 1 1&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;My goal is to identify when a row has more than 1 record&amp;nbsp;within the variable weight, height and income.&lt;/P&gt;&lt;P&gt;For example the cat, fred and jack rows all have 1 record for each variable, how will I find these values. I want to&amp;nbsp;identify row with more than 1 record separately from&amp;nbsp;row with only 1 record.&lt;/P&gt;&lt;P&gt;So I want the count of cat, fred and jack separately and the count of bob, mat, dog, sam separately. I already identify the latter using this code;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data check;&lt;/P&gt;&lt;P&gt;set test;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Arial" size="3"&gt;if &lt;/FONT&gt;weight&amp;nbsp;=1 or&amp;nbsp;height =1 or&amp;nbsp;income=1 then total_all=1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;else total_all=0;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 17:12:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-identify-multiple-records-within-a-row/m-p/714672#M220664</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2021-01-27T17:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I identify multiple records within a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-identify-multiple-records-within-a-row/m-p/714676#M220668</link>
      <description>&lt;P&gt;First identify which group a record belongs to and then you can determine later how to summarize them separately. You don't indicate how that would work so I'm guessing. It would have also been really helpful to see what you expect as output from this input. If my solution doesn't work, please post what you expect as output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set test;

if sum(weight, height, income)&amp;gt;1 then group = "2";
else group = "1";

run;

proc freq data=want;
table group;
table group*name / list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/253321"&gt;@CathyVI&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have to following synthetic data similar to my data. I have millions of records so this is demo I created.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Name $ sex $ weight height income;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;cards&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Bob M 1 0 0&lt;/P&gt;
&lt;P&gt;Mat M 0 1 0&lt;/P&gt;
&lt;P&gt;Cat F 1 0 1&lt;/P&gt;
&lt;P&gt;Dog F 1 0 0&lt;/P&gt;
&lt;P&gt;Fred M 0 1 1&lt;/P&gt;
&lt;P&gt;Sam M 0 0 1&lt;/P&gt;
&lt;P&gt;Pat F 0 0 0&lt;/P&gt;
&lt;P&gt;Jack M 1 1 1&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;My goal is to identify when a row has more than 1 record&amp;nbsp;within the variable weight, height and income.&lt;/P&gt;
&lt;P&gt;For example the cat, fred and jack rows all have 1 record for each variable, how will I find these values. I want to&amp;nbsp;identify row with more than 1 record separately from&amp;nbsp;row with only 1 record.&lt;/P&gt;
&lt;P&gt;So I want the count of cat, fred and jack separately and the count of bob, mat, dog, sam separately. I already identify the latter using this code;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data check;&lt;/P&gt;
&lt;P&gt;set test;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Arial" size="3"&gt;if &lt;/FONT&gt;weight&amp;nbsp;=1 or&amp;nbsp;height =1 or&amp;nbsp;income=1 then total_all=1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;else total_all=0;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 17:19:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-identify-multiple-records-within-a-row/m-p/714676#M220668</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-27T17:19:29Z</dc:date>
    </item>
  </channel>
</rss>

