<?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: Identify unpaired data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Identify-unpaired-data/m-p/929286#M365649</link>
    <description>&lt;P&gt;In my mind, counting questions are best handled by PROC FREQ.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have;
     tables id/noprint out=counts;
run;

data want;
    merge have counts(keep=id count);
    by id;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have to sort data set HAVE by ID in order for this to work.&lt;/P&gt;</description>
    <pubDate>Wed, 22 May 2024 17:53:59 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-05-22T17:53:59Z</dc:date>
    <item>
      <title>Identify unpaired data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-unpaired-data/m-p/929282#M365648</link>
      <description>&lt;P&gt;I have a dataset where the same sample ID is associated with two components (a and b), it also contains singular data (c). I'm trying to add a column that counts the number of occurrences of the ID so I can identify when I only have one of the two components. I'm trying to create the Count column in the table below so I could identify the unpaired component (in red text) using an if then statement (if Comp eq "a" and Count ne 2 then) and (if Comp eq "b" and Count ne 2 then).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Comp&lt;/TD&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;c&lt;/TD&gt;&lt;TD&gt;5236&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;3298&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;3298&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;a&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;4172&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;1&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;8723&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;8723&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;c&lt;/TD&gt;&lt;TD&gt;7692&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it were in Excel, it could be done using the COUNTIF function and dragging it down (=COUNTIF(B:B,B2)) Unfortunately I don't even know where to begin to do this in SAS and haven't had any luck Googling it. I would appreciate any direction you could give me.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 17:37:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-unpaired-data/m-p/929282#M365648</guid>
      <dc:creator>rstuart931</dc:creator>
      <dc:date>2024-05-22T17:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Identify unpaired data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-unpaired-data/m-p/929286#M365649</link>
      <description>&lt;P&gt;In my mind, counting questions are best handled by PROC FREQ.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have;
     tables id/noprint out=counts;
run;

data want;
    merge have counts(keep=id count);
    by id;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have to sort data set HAVE by ID in order for this to work.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 17:53:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-unpaired-data/m-p/929286#M365649</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-05-22T17:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: Identify unpaired data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-unpaired-data/m-p/929294#M365652</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;Thank you, that worked great!&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 18:32:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-unpaired-data/m-p/929294#M365652</guid>
      <dc:creator>rstuart931</dc:creator>
      <dc:date>2024-05-22T18:32:05Z</dc:date>
    </item>
  </channel>
</rss>

