<?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: Dynamic compare columns within groups in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-compare-columns-within-groups/m-p/231881#M42240</link>
    <description>&lt;P&gt;SQL to the rescue:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sql;
select * from past_evt as a
where not exists(
    select * from fut_evt 
    where city=a.city and area=a.area and ship_time=a.ship_time)
;&lt;BR /&gt;quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 27 Oct 2015 17:55:03 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2015-10-27T17:55:03Z</dc:date>
    <item>
      <title>Dynamic compare columns within groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-compare-columns-within-groups/m-p/231876#M42236</link>
      <description>&lt;P&gt;Dear SAS Folks,&lt;/P&gt;
&lt;P&gt;I have a question on comparing two columns from two data sets named past_evt and fut_evt.&lt;/P&gt;
&lt;P&gt;Both data sets were sorted by city. I need to compare the column named ‘city’ within each area + ship_time group between past_evt with fut_evt. Flag any ‘city’ that appeared in past_evt but not in fut_evt. Please keep in mind that the comparison should be conducted only within groups (ie. Area+ship_time), not across group.&lt;/P&gt;
&lt;P&gt;My thought is using first_variableNme and last_variableNme is a possible method for this question, but I don’t know how to do it. Is anybody can give me some suggestions?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Harry&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following is a sample of my data sets.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; past_evt;&lt;/P&gt;
&lt;P&gt;input city $ area $ ship_time TIME8.;&lt;/P&gt;
&lt;P&gt;cards;&lt;/P&gt;
&lt;P&gt;Brookf TX 21:37:55&lt;/P&gt;
&lt;P&gt;Cherok CA 9:36:18&lt;/P&gt;
&lt;P&gt;CHILLI TX 23:50:14&lt;/P&gt;
&lt;P&gt;FRN WA 18:45:23&lt;/P&gt;
&lt;P&gt;FRN WA 13:21:11&lt;/P&gt;
&lt;P&gt;FRN WA 4:30:24&lt;/P&gt;
&lt;P&gt;GALVES CO 21:38:18&lt;/P&gt;
&lt;P&gt;MARCEL IL 13:38:06&lt;/P&gt;
&lt;P&gt;NEEDLE FL 12:24:40&lt;/P&gt;
&lt;P&gt;Ravena NJ 3:25:48&lt;/P&gt;
&lt;P&gt;Ravena NJ 6:23:10&lt;/P&gt;
&lt;P&gt;SEATTL NY 9:19:13&lt;/P&gt;
&lt;P&gt;SEATTL NY 10:56:02&lt;/P&gt;
&lt;P&gt;STCOI TX 21:37:55&lt;/P&gt;
&lt;P&gt;STJOMO TX 9:36:18&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; FUT_evt;&lt;/P&gt;
&lt;P&gt;input city $ area $ ship_time TIME8.;&lt;/P&gt;
&lt;P&gt;cards;&lt;/P&gt;
&lt;P&gt;Brookf TX 21:37:55&lt;/P&gt;
&lt;P&gt;Cherok CA 9:36:18&lt;/P&gt;
&lt;P&gt;CHILLI TX 23:50:14&lt;/P&gt;
&lt;P&gt;LAFAYE CO 6:32:51&lt;/P&gt;
&lt;P&gt;MARCEL IL 19:32:16&lt;/P&gt;
&lt;P&gt;MARCEL IL 2:19:37&lt;/P&gt;
&lt;P&gt;Ravena NJ 3:25:48&lt;/P&gt;
&lt;P&gt;Ravena NJ 6:23:10&lt;/P&gt;
&lt;P&gt;STJOMO TX 9:36:18&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2015 17:25:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-compare-columns-within-groups/m-p/231876#M42236</guid>
      <dc:creator>HarryLiu</dc:creator>
      <dc:date>2015-10-27T17:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic compare columns within groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-compare-columns-within-groups/m-p/231881#M42240</link>
      <description>&lt;P&gt;SQL to the rescue:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sql;
select * from past_evt as a
where not exists(
    select * from fut_evt 
    where city=a.city and area=a.area and ship_time=a.ship_time)
;&lt;BR /&gt;quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Oct 2015 17:55:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-compare-columns-within-groups/m-p/231881#M42240</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-10-27T17:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic compare columns within groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dynamic-compare-columns-within-groups/m-p/232000#M42262</link>
      <description>Dear PGStats,&lt;BR /&gt;Thanks very much for your quick response. I like this code, since it is simple and concise. I appreciate your time very much!&lt;BR /&gt;Thanks,&lt;BR /&gt;Harry</description>
      <pubDate>Wed, 28 Oct 2015 13:58:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dynamic-compare-columns-within-groups/m-p/232000#M42262</guid>
      <dc:creator>HarryLiu</dc:creator>
      <dc:date>2015-10-28T13:58:24Z</dc:date>
    </item>
  </channel>
</rss>

