<?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: By Group occurances in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334979#M75712</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Yep, I got that. &amp;nbsp;My code's sub-query creates a list of ID's only where they have a record for either Math or Eng and the date being after 01Jan2000. &amp;nbsp;Then it selects the data with ID in that list of IDs. &amp;nbsp;Seems to match what the OP asked?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Actually, when I ran your code with the slight change from "score" to "date":&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Grade $ ST_ID $ Course $ Score date;
informat date ddmmyy8.;
format date date9.;
cards; 
Grade10 101 Eng 20 01/01/82
Grade11 105 Bio 25 25/11/99
Grade11 105 Math 18 23/09/00
Grade11 105 Eng 15 11/12/01
Grade11 105 Math 15 14/12/05
Grade11 105 Phy 15 21/03/08
Grade11 102 Eng 15 13/07/02
Grade11 102 Bio 20 22/11/07
Grade11 102 Phy 16 19/04/88
Grade11 102 Math 21 27/08/99
Grade11 104 Arts 13 18/06/00
Grade11 104 Che 12 14/07/09
Grade11 104 Eng 18 09/03/08
Grade11 104 Bio 21 25/11/13
Grade12 103 Bio 10 13/12/99
Grade12 103 Math 20 25/05/01
Grade12 103 Eng 16 04/04/06
Grade12 103 Che 15 09/11/02
Grade12 103 Phy 17 16/03/15
;
run;

proc sql;
  create table WANT as 
  select  *
  from    HAVE
  where GRADE in (select distinct GRADE 
                  from   HAVE 
                  where  COURSE in ("Math","Eng")
                    and  date &amp;gt; "01JAN2000"d);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I got 18 observations. So the where condition and the variables used for matching need to be adapted. Since this got quite complicated quite quickly (at least for me), I chose the data step approach.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Feb 2017 15:08:40 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-02-22T15:08:40Z</dc:date>
    <item>
      <title>By Group occurances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334931#M75693</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I have the following table. How do I select all ID's of By Group where 'Math' or 'Bio' occured only after 01 Jan 2000.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Grade $ ST_ID $ Course $ Score date;
informat date ddmmyy8.;
format date date9.;
cards; 
Grade10 101 Eng 20 01/01/82
Grade11 105 Bio 25 25/11/99
Grade11 105 Math 18 23/09/00
Grade11 105 Eng 15 11/12/01
Grade11 105 Math 15 14/12/05
Grade11 105 Phy 15 21/03/08
Grade11 102 Eng 15 13/07/02
Grade11 102 Bio 20 22/11/07
Grade11 102 Phy 16 19/04/88
Grade11 102 Math 21 27/08/99
Grade11 104 Arts 13 18/06/00
Grade11 104 Che 12 14/07/09
Grade11 104 Eng 18 09/03/08
Grade11 104 Bio 21 25/11/13
Grade12 103 Bio 10 13/12/99
Grade12 103 Math 20 25/05/01
Grade12 103 Eng 16 04/04/06
Grade12 103 Che 15 09/11/02
Grade12 103 Phy 17 16/03/15
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Expected Output:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Grade11 104 Arts 13&amp;nbsp;18Jun2000&lt;BR /&gt;Grade11 104 Che 12&amp;nbsp;14Jul2009&lt;BR /&gt;Grade11 104 Eng 18 09Mar2008&lt;BR /&gt;Grade11 104 Bio 21&amp;nbsp;25Nov2013&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 13:03:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334931#M75693</guid>
      <dc:creator>mlogan</dc:creator>
      <dc:date>2017-02-22T13:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: By Group occurances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334933#M75694</link>
      <description>&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as 
  select  *
  from    HAVE
  where GRADE in (select distinct GRADE &lt;BR /&gt;                  from   HAVE 
                  where  COURSE in ("Math","Eng")
                    and  SCORE &amp;gt; "01JAN2000"d);
quit;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Feb 2017 13:07:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334933#M75694</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-22T13:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: By Group occurances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334936#M75695</link>
      <description>&lt;P&gt;What constitutes a by group (which variables)?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 13:27:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334936#M75695</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-22T13:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: By Group occurances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334952#M75698</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The op's request was "where 'Math' or 'Bio' occured &lt;EM&gt;&lt;STRONG&gt;only&lt;/STRONG&gt;&lt;STRONG&gt; after&lt;/STRONG&gt;&lt;/EM&gt; 01 Jan 2000".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's not ambiguously put, and&amp;nbsp;means exactly what it says, then you&amp;nbsp;probably want to exclude by group's in which any 'Math' or 'Bio" occurred on or before&amp;nbsp;01jan2000 - maybe through a limit on the minimum score for 'Math' or 'Bio' within a group.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 14:00:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334952#M75698</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-22T14:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: By Group occurances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334956#M75699</link>
      <description>&lt;P&gt;Yep, I got that. &amp;nbsp;My code's sub-query creates a list of ID's only where they have a record for either Math or Eng and the date being after 01Jan2000. &amp;nbsp;Then it selects the data with ID in that list of IDs. &amp;nbsp;Seems to match what the OP asked?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 14:13:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334956#M75699</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-22T14:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: By Group occurances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334957#M75700</link>
      <description>&lt;P&gt;I think I see clearer now. My suggestion is to create a lookup table for groups and merge back with that:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have;
by grade st_id;
run;

data lookup (keep=grade st_id);
set have;
by grade st_id ;
retain flag;
if first.st_id
then flag = .;
if course in ('Math','Bio')
then do;
  if flag lt 1
  then if date lt '01jan2000'd
    then flag = 1;
    else flag = 0;
end;
if last.st_id and missing(flag) or flag then output;
run;

data want;
merge
  have (in=a)
  lookup (in=b)
;
by grade st_id;
if a and not b;
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The result looks like the expected one:&lt;/P&gt;
&lt;PRE&gt; Grade     ST_ID    Course    Score         date

Grade11     104      Arts       13     18JUN2000
Grade11     104      Che        12     14JUL2009
Grade11     104      Eng        18     09MAR2008
Grade11     104      Bio        21     25NOV2013
&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Feb 2017 14:15:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334957#M75700</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-22T14:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: By Group occurances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334969#M75704</link>
      <description>&lt;P&gt;Good case for using a double dow:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want (drop=keep);
  do until (last.ST_ID);
    set have;
    by ST_ID notsorted;
    if first.st_id then keep=0;
    if keep ne -1 then do;
      if strip(Course) in ('Bio', 'Math') and date lt '01jan2000'd then keep=-1;
      else if strip(Course) in ('Bio', 'Math') and date gt '01jan2000'd then keep=1;
    end;
  end;
  do until (last.ST_ID);
    set have;
    by ST_ID notsorted;
    if keep eq 1 then output;
  end;
run;
&lt;/PRE&gt;
&lt;P&gt;Interesting that the in operator wouldn't work as expected unless I stripped the Course variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 14:45:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334969#M75704</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-22T14:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: By Group occurances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334976#M75709</link>
      <description>&lt;P&gt;My point is that if a by-group had a 'Math' or 'Bio' BOTH before and after the cut date, it is not clear from the OP's description that such a by group is wanted.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I.e. in the data set below do you want grade='Math before and After'?&amp;nbsp; The phrase "where 'Math' or 'Bio' occured &lt;EM&gt;&lt;STRONG&gt;only&lt;/STRONG&gt;&lt;/EM&gt; after 01 Jan 2000" suggests an intention to exclude that by group (assuming that grade is the "by group" variable).&amp;nbsp; That's why I suggested a within-group minimum criterion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="SAS Monospace" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;&amp;nbsp;&amp;nbsp;grade=&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'Math before and after'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;&amp;nbsp;&amp;nbsp;do&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; score=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;'01jan1990'd&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="SAS Monospace" size="2"&gt;, &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;'01jan2001'd&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="SAS Monospace" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; course=&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'Math'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'Hist'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;output&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;end&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;&amp;nbsp;&amp;nbsp;end&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;&amp;nbsp;&amp;nbsp;grade=&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'Math before only'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;&amp;nbsp;&amp;nbsp;score=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;'01jan1990'd&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="SAS Monospace" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;&amp;nbsp; do&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; course=&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'Math'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'Hist'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;output&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;end&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;&amp;nbsp; grade=&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'Math After Only'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;&amp;nbsp;&amp;nbsp;score=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;'01jan2001'd&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="SAS Monospace" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;&amp;nbsp; do&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; course=&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'Math'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'Hist'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;output&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;end&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;&amp;nbsp; format&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; score &lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;date9.&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="SAS Monospace" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 15:03:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334976#M75709</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-22T15:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: By Group occurances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334979#M75712</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Yep, I got that. &amp;nbsp;My code's sub-query creates a list of ID's only where they have a record for either Math or Eng and the date being after 01Jan2000. &amp;nbsp;Then it selects the data with ID in that list of IDs. &amp;nbsp;Seems to match what the OP asked?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Actually, when I ran your code with the slight change from "score" to "date":&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Grade $ ST_ID $ Course $ Score date;
informat date ddmmyy8.;
format date date9.;
cards; 
Grade10 101 Eng 20 01/01/82
Grade11 105 Bio 25 25/11/99
Grade11 105 Math 18 23/09/00
Grade11 105 Eng 15 11/12/01
Grade11 105 Math 15 14/12/05
Grade11 105 Phy 15 21/03/08
Grade11 102 Eng 15 13/07/02
Grade11 102 Bio 20 22/11/07
Grade11 102 Phy 16 19/04/88
Grade11 102 Math 21 27/08/99
Grade11 104 Arts 13 18/06/00
Grade11 104 Che 12 14/07/09
Grade11 104 Eng 18 09/03/08
Grade11 104 Bio 21 25/11/13
Grade12 103 Bio 10 13/12/99
Grade12 103 Math 20 25/05/01
Grade12 103 Eng 16 04/04/06
Grade12 103 Che 15 09/11/02
Grade12 103 Phy 17 16/03/15
;
run;

proc sql;
  create table WANT as 
  select  *
  from    HAVE
  where GRADE in (select distinct GRADE 
                  from   HAVE 
                  where  COURSE in ("Math","Eng")
                    and  date &amp;gt; "01JAN2000"d);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I got 18 observations. So the where condition and the variables used for matching need to be adapted. Since this got quite complicated quite quickly (at least for me), I chose the data step approach.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 15:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334979#M75712</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-22T15:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: By Group occurances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334988#M75717</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm guessing at least some of the other solutions here are fine, but here's my approach:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    CREATE TABLE want AS
    SELECT * FROM have
    GROUP BY st_id
    HAVING max((course in ('Bio', 'Math')) and (date &amp;gt; '01JAN2000'd)) = 1 AND
           max((course in ('Bio', 'Math')) and (date &amp;lt;= '01JAN2000'd)) = 0 
    ORDER BY grade, st_id;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Feb 2017 15:28:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/334988#M75717</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-02-22T15:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: By Group occurances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/335193#M75831</link>
      <description>&lt;P&gt;Mine like Arthur's code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Grade $ ST_ID $ Course $ Score date;
informat date ddmmyy8.;
format date date9.;
cards; 
Grade10 101 Eng 20 01/01/82
Grade11 105 Bio 25 25/11/99
Grade11 105 Math 18 23/09/00
Grade11 105 Eng 15 11/12/01
Grade11 105 Math 15 14/12/05
Grade11 105 Phy 15 21/03/08
Grade11 102 Eng 15 13/07/02
Grade11 102 Bio 20 22/11/07
Grade11 102 Phy 16 19/04/88
Grade11 102 Math 21 27/08/99
Grade11 104 Arts 13 18/06/00
Grade11 104 Che 12 14/07/09
Grade11 104 Eng 18 09/03/08
Grade11 104 Bio 21 25/11/13
Grade12 103 Bio 10 13/12/99
Grade12 103 Math 20 25/05/01
Grade12 103 Eng 16 04/04/06
Grade12 103 Che 15 09/11/02
Grade12 103 Phy 17 16/03/15
;
run;
data want;
has_key=0;after_date=1;
  do until (last.ST_ID);
    set have;
    by grade ST_ID notsorted;
    if strip(Course) in ('Bio', 'Math') then do;
     has_key=1;
     if date lt '01jan2000'd then after_date=0;
    end;
  end;
  do until (last.ST_ID);
    set have;
    by grade ST_ID notsorted;
    if has_key and after_date then output;
  end;
drop has_key after_date;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Feb 2017 03:46:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/335193#M75831</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-02-23T03:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: By Group occurances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/335195#M75832</link>
      <description>&lt;P&gt;If a proc sort is acceptable, then you can have a VERY simple program:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have;
  by grade st_id;
run;

data want;
  merge have (in=in1 where=(course in ('Math','Bio') and date&amp;lt;'01jan2000'd))
        have (in=in2 where=(course in ('Math','Bio') and date&amp;gt;='01jan2000'd))
        have ;
  by grade st_id;
  if in2&amp;gt;in1;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Feb 2017 04:07:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-occurances/m-p/335195#M75832</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-23T04:07:34Z</dc:date>
    </item>
  </channel>
</rss>

