<?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: Identifying Differences in a Group of Data in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Identifying-Differences-in-a-Group-of-Data/m-p/540426#M33212</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thank you for the response! It's very close to what I need. Here's what I'm seeing:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Unit&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Field&lt;/TD&gt;&lt;TD&gt;flag&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1391&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;6/15/2018&lt;/TD&gt;&lt;TD&gt;E18&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1391&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;6/15/2018&lt;/TD&gt;&lt;TD&gt;E18&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1391&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;12/15/2018&lt;/TD&gt;&lt;TD&gt;E02&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1391&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;6/15/2018&lt;/TD&gt;&lt;TD&gt;E18&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1391&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;12/15/2018&lt;/TD&gt;&lt;TD&gt;E02&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;This ID would not need flagged, due to 6/15/2018 all being E18, while 12/15/2018 is all E02. If the field on the same date is the same, it's good. Only looking to flag the ID's that have different Fields on the same Date, per ID. (If that makes sense)&lt;/P&gt;</description>
    <pubDate>Tue, 05 Mar 2019 13:06:09 GMT</pubDate>
    <dc:creator>BPT227</dc:creator>
    <dc:date>2019-03-05T13:06:09Z</dc:date>
    <item>
      <title>Identifying Differences in a Group of Data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Identifying-Differences-in-a-Group-of-Data/m-p/540198#M33198</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a list of data in the 10-100's of thousands that changes weekly. I'm trying to find out if a unit has different data entered than the others in the group, on the same date. For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Unit&lt;/TD&gt;&lt;TD&gt;Field&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1297&lt;/TD&gt;&lt;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gt;1318&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;G02&lt;/TD&gt;&lt;TD&gt;12/05/2018&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1318&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;G02&lt;/TD&gt;&lt;TD&gt;06/05/2018&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1318&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;G02&lt;/TD&gt;&lt;TD&gt;12/05/2018&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1318&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;G07&lt;/TD&gt;&lt;TD&gt;06/05/2018&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the case above, I'd want a way to flag ID 1318, on 06/05/2018 because 2 of the units have G02, while the third has G07. Also, as an added difficulty step... some of the fields might start with something other than G. I want to ignore those from the comparison (so if a ID has 3 units, and 1 unit is P01, while other 2 are G01, it wouldn't need flagged)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help on this would be greatly appreciated! Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2019 20:31:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Identifying-Differences-in-a-Group-of-Data/m-p/540198#M33198</guid>
      <dc:creator>BPT227</dc:creator>
      <dc:date>2019-03-04T20:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying Differences in a Group of Data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Identifying-Differences-in-a-Group-of-Data/m-p/540217#M33200</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input ID	Unit	Field $	Date :mmddyy10.;
format Date mmddyy10.;
cards;
1297	1	G02	04/09/2018
1297	1	G02	09/30/2018
1300	1	G04	03/01/2018
1300	2	G04	03/19/2018
1300	2	G04	08/01/2018
1304	1	G03	12/01/2018
1315	1	G01	01/23/2018
1315	2	G01	01/23/2018
1318	1	G02	06/05/2018
1318	1	G02	12/05/2018
1318	2	G02	06/05/2018
1318	2	G02	12/05/2018
1318	3	G07	06/05/2018
1318	3	P01 06/05/2018
;

proc sql;
create table want(drop=t f) as
select *,max(f) as flag
from
(select *,first(field)='G' as t,(count(distinct field)&amp;gt;1)*(calculated t=1) as f from have group by id,t)
group by id;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;/* Assuming I understand your requirement and the above meets your desired. I added one more PO1 to the last id. If want to flag only G subgroup, proc sql can be made even shorter*/&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265114"&gt;@BPT227&lt;/a&gt;&amp;nbsp; A more efficient would be DOW, and I find that boring as a video game to play. Kindly wait for somebody to give you that. If not, I will post that later. Proc sql is something not so efficient here, but i enjoy having fun. Cheers&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2019 20:59:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Identifying-Differences-in-a-Group-of-Data/m-p/540217#M33200</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-03-04T20:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying Differences in a Group of Data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Identifying-Differences-in-a-Group-of-Data/m-p/540252#M33201</link>
      <description>&lt;P&gt;Just to be clear on the logic here. You say:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;"In the case above, I'd want a way to flag ID 1318, on 06/05/2018 because 2 of the units have G02, while the third has G07".&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;However, as I see it, it is the fifth observation in the ID=1318 group that has Field="G07"?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2019 21:40:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Identifying-Differences-in-a-Group-of-Data/m-p/540252#M33201</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-04T21:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying Differences in a Group of Data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Identifying-Differences-in-a-Group-of-Data/m-p/540275#M33202</link>
      <description>&lt;P&gt;Just so there are choices, here is a simple set of tools:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test_me / view=test_me;
set have;
field = substr(field, 2);
run;

proc freq data=test_me;
   tables id * date * field / noprint out=combos (rename=(count=field_count));
run;

proc freq data=combos;
   tables id * date / noprint out=print_me (where=(count &amp;gt; 1) drop=percent);
run;

proc print data=print_me;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The idea is the TEST_ME is view (takes virtually 0 time to create it) tnat revises the FIELD values by chopping off the first character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then COMBOS contains one observation for each ID / DATE / FIELD found.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Feed that into a second PROC FREQ, to count how many fields there are per ID / DATE.&amp;nbsp; Keep just those with more than 1 field.&amp;nbsp; The final data set PRINT_ME contains COUNT, a count of the number of different fields found for that ID / DATE.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2019 22:45:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Identifying-Differences-in-a-Group-of-Data/m-p/540275#M33202</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-04T22:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying Differences in a Group of Data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Identifying-Differences-in-a-Group-of-Data/m-p/540277#M33203</link>
      <description>&lt;P&gt;Very innovative use of proc freq. I learned something new. Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2019 22:47:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Identifying-Differences-in-a-Group-of-Data/m-p/540277#M33203</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-03-04T22:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying Differences in a Group of Data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Identifying-Differences-in-a-Group-of-Data/m-p/540426#M33212</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thank you for the response! It's very close to what I need. Here's what I'm seeing:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Unit&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Field&lt;/TD&gt;&lt;TD&gt;flag&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1391&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;6/15/2018&lt;/TD&gt;&lt;TD&gt;E18&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1391&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;6/15/2018&lt;/TD&gt;&lt;TD&gt;E18&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1391&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;12/15/2018&lt;/TD&gt;&lt;TD&gt;E02&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1391&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;6/15/2018&lt;/TD&gt;&lt;TD&gt;E18&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1391&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;12/15/2018&lt;/TD&gt;&lt;TD&gt;E02&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;This ID would not need flagged, due to 6/15/2018 all being E18, while 12/15/2018 is all E02. If the field on the same date is the same, it's good. Only looking to flag the ID's that have different Fields on the same Date, per ID. (If that makes sense)&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 13:06:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Identifying-Differences-in-a-Group-of-Data/m-p/540426#M33212</guid>
      <dc:creator>BPT227</dc:creator>
      <dc:date>2019-03-05T13:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying Differences in a Group of Data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Identifying-Differences-in-a-Group-of-Data/m-p/540468#M33213</link>
      <description>&lt;P&gt;While I agree with you, I didn't write the code that would assign flag.&amp;nbsp; I only wrote enough to identify who needs to be flagged.&amp;nbsp; So please supply the log from the entire process:&amp;nbsp; creating the flags and then assigning them.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 15:07:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Identifying-Differences-in-a-Group-of-Data/m-p/540468#M33213</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-05T15:07:16Z</dc:date>
    </item>
  </channel>
</rss>

