<?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: Is there an alternative to in( ) in Proc SQL? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363113#M85897</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;would it also be possible to skip the following sorting part of the code:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=import2;
by mgrno descending fdate;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The import2&amp;nbsp;dataset&amp;nbsp;is the enormously large one and I am retrieving it from another server (so it's not on my SAS Studio or local disk). In fact, when I try to do so, I get the following error message:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 61         
 62         proc sort data=mbp.t21 force;
 63         by mgrno descending fdate;
 64         run;
 
 ERROR: User does not have appropriate authorization level for library MBP.
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 65         
 66         
 67         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 31 May 2017 15:22:40 GMT</pubDate>
    <dc:creator>Yegen</dc:creator>
    <dc:date>2017-05-31T15:22:40Z</dc:date>
    <item>
      <title>Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/362990#M85823</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Disclaimer:&lt;/STRONG&gt; Thanks to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;for providing extensive help on this issue, the speed of the code increased dramatically (saved several hours). &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;has also provided an alternative solution using PROC SQL. If one wants to use PROC SQL, please see&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;'s solution (with the having clause)&amp;nbsp;or&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;'s solution. Given that &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;answered first, I had to accept his first. Both thanks so much to both of you!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Question starts here:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to find an alternative way to write the following code by not relying on in:&lt;/P&gt;&lt;P&gt;&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;proc sql;
	create table work.sample1 as
	select a.*, b.*
	from WORK.IMPORT2 as a 
	right join work.portfolio as b
	on a.mgrno=b.mgrno
	where a.fdate in(
		select max(fdate) as last_fdate
		from WORK.IMPORT2
		where a.mgrno=b.mgrno and fdate &amp;lt; Announcement);
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The dataset "work.portfolio" contains entries as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;mgrno&lt;/TD&gt;&lt;TD&gt;announcement&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9385&lt;/TD&gt;&lt;TD&gt;9/16/09&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;62890&lt;/TD&gt;&lt;TD&gt;9/14/08&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;The dataset "WORK.IMPORT2" contains entries as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;mgrno&lt;/TD&gt;&lt;TD&gt;fdate&lt;/TD&gt;&lt;TD&gt;cusip&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9385&lt;/TD&gt;&lt;TD&gt;12/31/07&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9385&lt;/TD&gt;&lt;TD&gt;12/31/08&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9385&lt;/TD&gt;&lt;TD&gt;12/31/09&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9385&lt;/TD&gt;&lt;TD&gt;12/31/07&lt;/TD&gt;&lt;TD&gt;23456&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9385&lt;/TD&gt;&lt;TD&gt;12/31/08&lt;/TD&gt;&lt;TD&gt;23456&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9385&lt;/TD&gt;&lt;TD&gt;12/31/07&lt;/TD&gt;&lt;TD&gt;34567&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9385&lt;/TD&gt;&lt;TD&gt;12/31/07&lt;/TD&gt;&lt;TD&gt;78911&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9385&lt;/TD&gt;&lt;TD&gt;12/31/08&lt;/TD&gt;&lt;TD&gt;78912&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;62890&lt;/TD&gt;&lt;TD&gt;9/13/08&lt;/TD&gt;&lt;TD&gt;34567&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;62890&lt;/TD&gt;&lt;TD&gt;9/13/07&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;62890&lt;/TD&gt;&lt;TD&gt;9/13/11&lt;/TD&gt;&lt;TD&gt;22345&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following two questions:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Q1:&lt;/STRONG&gt; Is there an alternative (and more efficient) way of writing the code stated above without using IN( )? In particular, I am trying to select the most recent fdates&amp;nbsp;that are before announcement.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Q2:&lt;/STRONG&gt; How can I select the most recent fdates by cusip and mgrno such that fdate &amp;lt; announcement? In Q1, I am only concerned about the most recent&amp;nbsp;last fdates by MGRNO, but here I also want to see how to break down this specification into MGRNO and CUSIP.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for any help / suggestions.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 19:29:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/362990#M85823</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-06-01T19:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363012#M85837</link>
      <description>&lt;P&gt;Well, I have no test data to try this on, but maybe something like:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
	create &lt;SPAN class="token statement"&gt;table&lt;/SPAN&gt; work&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;sample1 as
	&lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; b&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;
	&lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; WORK&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;IMPORT2 as a 
	&lt;SPAN class="token function"&gt;right&lt;/SPAN&gt; join work&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;portfolio as b
	on a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;mgrno&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;b&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;mgrno&lt;BR /&gt;        group by a.mgrno&lt;BR /&gt;        having b.fdate=max(b.fdate);
&lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 May 2017 10:45:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363012#M85837</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-05-31T10:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363018#M85840</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;. With&amp;nbsp;your code, however, I cannot compare the max(fdate) with the announcement. I was trying to use "having" too, but I got stuck when I tried to select the&amp;nbsp;max(fdate)&amp;nbsp;such that fdate&amp;lt;announcement. In other words, how would it be possible to use "having" so that I can select the most recent fdate [i.e., max(fdate)] from the fdates that are less than announcement?&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 10:58:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363018#M85840</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-05-31T10:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363040#M85853</link>
      <description>&lt;P&gt;Post some test data in the form of a datastep, and what the output should look like. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 11:58:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363040#M85853</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-05-31T11:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363044#M85854</link>
      <description>&lt;P&gt;You did not post the output yet .&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 portfolio;
infile cards expandtabs truncover;
input mgrno	announcement : mmddyy10.;
format announcement mmddyy10.;
cards;
9385	9/16/09
62890	9/14/08
;
run;
data IMPORT2;
 infile cards expandtabs truncover;
input mgrno	fdate  : mmddyy10.	cusip;
format fdate mmddyy10.;
cards;
9385	12/31/07	12345
9385	12/31/08	12345
9385	12/31/09	12345
9385	12/31/07	23456
9385	12/31/08	23456
9385	12/31/07	34567
9385	12/31/07	78911
9385	12/31/08	78912
62890	9/13/08	34567
62890	9/13/07	12345
62890	9/13/11	22345
;
run;
proc sort data=portfolio;
by mgrno announcement;
run;
proc sort data=import2;
by mgrno fdate;
run;
data want;
 set portfolio(rename=(announcement=fdate) in=ina) import2(in=inb);
 by mgrno fdate;
 retain want;
 if first.mgrno then call missing(want);
 if ina then want=fdate;
 if inb;
format want mmddyy10.;
run;
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 May 2017 12:28:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363044#M85854</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-05-31T12:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363045#M85855</link>
      <description>&lt;P&gt;Thanks for posting the data code,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The output data would need to look like:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;mgrno&lt;/TD&gt;&lt;TD&gt;fdate&lt;/TD&gt;&lt;TD&gt;cusip&lt;/TD&gt;&lt;TD&gt;announcement&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9385&lt;/TD&gt;&lt;TD&gt;12/31/08&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;9/16/09&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9385&lt;/TD&gt;&lt;TD&gt;12/31/08&lt;/TD&gt;&lt;TD&gt;23456&lt;/TD&gt;&lt;TD&gt;9/16/09&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9385&lt;/TD&gt;&lt;TD&gt;12/31/08&lt;/TD&gt;&lt;TD&gt;78912&lt;/TD&gt;&lt;TD&gt;9/16/09&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;62890&lt;/TD&gt;&lt;TD&gt;9/13/08&lt;/TD&gt;&lt;TD&gt;34567&lt;/TD&gt;&lt;TD&gt;9/14/08&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;These are the rows that have a max(fdate) that&amp;nbsp;is smaller than the announcement.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 12:40:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363045#M85855</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-05-31T12:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363057#M85863</link>
      <description>&lt;P&gt;OK. How about this one .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data portfolio;
infile cards expandtabs truncover;
input mgrno	announcement : mmddyy10.;
format announcement mmddyy10.;
cards;
9385	9/16/09
62890	9/14/08
;
run;
data IMPORT2;
 infile cards expandtabs truncover;
input mgrno	fdate  : mmddyy10.	cusip;
format fdate mmddyy10.;
cards;
9385	12/31/07	12345
9385	12/31/08	12345
9385	12/31/09	12345
9385	12/31/07	23456
9385	12/31/08	23456
9385	12/31/07	34567
9385	12/31/07	78911
9385	12/31/08	78912
62890	9/13/08	34567
62890	9/13/07	12345
62890	9/13/11	22345
;
run;
proc sort data=portfolio;
by mgrno descending announcement;
run;
proc sort data=import2;
by mgrno descending fdate;
run;
data temp;
 set portfolio(rename=(announcement=fdate) in=ina) import2(in=inb);
 by mgrno descending fdate;
 retain want;
 if first.mgrno then call missing(want);
 if ina then want=fdate;
 if inb;
format want mmddyy10.;
run;
data want;
 set temp(where=(want is not missing));
 by mgrno fdate notsorted;
 if first.mgrno then n=0;
 n+first.fdate;
 if n=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 May 2017 13:23:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363057#M85863</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-05-31T13:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363067#M85867</link>
      <description>&lt;P&gt;if max(fdate) = announcement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can reverse the position of these two tables.&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; portfolio&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;rename&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;announcement&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;fdate&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;in&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;ina&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; import2&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;in&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;inb&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;--&amp;gt;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt;  import2&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;in&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;inb&lt;SPAN class="token punctuation"&gt;) portfolio(&lt;SPAN class="token function"&gt;rename&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;(announcement&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;fdate) &lt;SPAN class="token operator"&gt;in&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;ina)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 13:39:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363067#M85867</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-05-31T13:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363075#M85873</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144925"&gt;@Yegen&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;. With&amp;nbsp;your code, however, I cannot compare the max(fdate) with the announcement. I was trying to use "having" too, but I got stuck when I tried to select the&amp;nbsp;max(fdate)&amp;nbsp;such that fdate&amp;lt;announcement. In other words,&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt; how would it be possible to use "having" so that I can select the most recent fdate [i.e., max(fdate)] from the fdates that are less than announcement?&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Include that date constraint prior to the "group by&amp;nbsp; ... having" clause:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table work.sample1 as
    select a.*, b.* from 
    WORK.IMPORT2 as a 
      right join
    work.portfolio as b
    on a.mgrno=b.mgrno
    where a.fdate&amp;lt;=b.announcement
    group by a.mgrno        having a.fdate=max(a.fdate);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 May 2017 13:54:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363075#M85873</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-05-31T13:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363098#M85889</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;, you just blow my mind with the two codes. They work magically well! Before testing it on the actual dataset (with close to a billion observations), I have two quick questions.&lt;BR /&gt;&lt;BR /&gt;Q1: Could you please elaborate what you are doing in the following step (especially the set statement):&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
&amp;nbsp;set portfolio(rename=(announcement=fdate) in=ina) import2(in=inb);&lt;BR /&gt; by mgrno descending fdate;
 retain want;
 if first.mgrno then call missing(want);
 if ina then want=fdate;
 if inb;
format want mmddyy10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;By looking at the output, I can infer&amp;nbsp;that you are adding the announcement dates to the fdates where the&amp;nbsp;fdate &amp;lt; announcement date. Then in the last part of the code (not pasted in this reply, but is in your post), you are keeping only the observations that are the most recent fdates.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Q2: What's the difference between reversing the position of the two tables? Which one would it be more efficient if there is a lot of redundant / unwanted data in the table that has the fdate (i.e., import2).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks again, I will give it a try on the actual dataset.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 14:53:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363098#M85889</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-05-31T14:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363113#M85897</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;would it also be possible to skip the following sorting part of the code:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=import2;
by mgrno descending fdate;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The import2&amp;nbsp;dataset&amp;nbsp;is the enormously large one and I am retrieving it from another server (so it's not on my SAS Studio or local disk). In fact, when I try to do so, I get the following error message:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 61         
 62         proc sort data=mbp.t21 force;
 63         by mgrno descending fdate;
 64         run;
 
 ERROR: User does not have appropriate authorization level for library MBP.
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 65         
 66         
 67         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 15:22:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363113#M85897</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-05-31T15:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363115#M85898</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;, thanks for your suggestion. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;I somehow missed to see your suggestion and just saw&amp;nbsp;it. I had a very similar code before but it did not work. I gave your suggestion a try and it seems to work very well. Just to ask a clarification question, the following part of the code is executed after removing all rows that have fdate &amp;lt; announcement, right?&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    group by a.mgrno        having a.fdate=max(a.fdate);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;I run the code on a subset of the dataset and the output looked correct. Before applying it to the larger dataset, I&amp;nbsp;wanted to double check that the "having"&amp;nbsp;clause is always run on the dataset that is created after the "where" clause (i.e., on the subset of the original data).&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 15:17:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363115#M85898</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-05-31T15:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363124#M85904</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144925"&gt;@Yegen&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Just to ask a clarification question, the following part of the code is executed after removing all rows that have fdate &amp;lt; announcement, right?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think so.&amp;nbsp; But, in the experimental dataset, move the where clause to after the "group by ... having".&amp;nbsp; I suspect you will get fewer obserations, or maybe&amp;nbsp;zero observations (if each mgr had at least one fdate&amp;gt;announcement).&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 15:29:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363124#M85904</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-05-31T15:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363390#M86041</link>
      <description>&lt;P&gt;1) SET + BY&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;is crossing insert obs according BY varibale.&lt;/P&gt;
&lt;P&gt;if you delete "if inb;" you will see what happen.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;E.X.&lt;/P&gt;
&lt;P&gt;TableA&lt;/P&gt;
&lt;P&gt;date&lt;/P&gt;
&lt;P&gt;2010-01-02&lt;/P&gt;
&lt;P&gt;2012-02-02&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TableB&lt;/P&gt;
&lt;P&gt;date&lt;/P&gt;
&lt;P&gt;2010-01-04&lt;/P&gt;
&lt;P&gt;2012-02-01&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After SET+BY&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set A B;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;by date;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will get:&lt;/P&gt;
&lt;P&gt;2010-01-02 &amp;nbsp;&amp;lt;--From A&lt;/P&gt;
&lt;P&gt;2010-01-04&lt;/P&gt;
&lt;P&gt;2012-02-01&lt;/P&gt;
&lt;P&gt;2012-02-02 &amp;lt;--From B&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2)fdate = announcement ,and you don't want this fdate as the max(most recent) fdate,&lt;/P&gt;
&lt;P&gt;you could reverse the position of these two table.&lt;/P&gt;
&lt;P&gt;E.X.&lt;/P&gt;
&lt;P&gt;After SET+BY , you get this&lt;/P&gt;
&lt;P&gt;2010-01-04&lt;/P&gt;
&lt;P&gt;2012-02-02&lt;/P&gt;
&lt;P&gt;2012-02-02 &amp;lt;--From Portfolio&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if you don't want&amp;nbsp;&lt;SPAN&gt;2012-02-02 as the most recent fdate, change&amp;nbsp; position of these two table ,You will got:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;2010-01-04&lt;/P&gt;
&lt;P&gt;2012-02-02&amp;nbsp;&amp;lt;--From Portfolio&lt;/P&gt;
&lt;P&gt;2012-02-02&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 12:26:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363390#M86041</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-06-01T12:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363392#M86043</link>
      <description>&lt;P&gt;NO. You can't . But if your data has been sorted by these two variables. You could try to skip these proc sort and see what happened.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternative way is making a copy and proc sort .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data copy ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set mbp.t21&amp;nbsp;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;proc sort data=copy............&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 12:29:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363392#M86043</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-06-01T12:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363396#M86047</link>
      <description>&lt;P&gt;If you have multiple date for the same mgrno.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this one .&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 portfolio;
infile cards expandtabs truncover;
input mgrno	announcement : mmddyy10.;
format announcement mmddyy10.;
cards;
9385	9/16/09
9385	9/16/08
62890	9/14/08
;
run;
data IMPORT2;
 infile cards expandtabs truncover;
input mgrno	fdate  : mmddyy10.	cusip;
format fdate mmddyy10.;
cards;
9385	12/31/07	12345
9385	12/31/08	12345
9385	12/31/09	12345
9385	12/31/07	23456
9385	12/31/08	23456
9385	12/31/07	34567
9385	12/31/07	78911
9385	12/31/08	78912
9385	12/31/06	78912
9385	12/31/06	78912
62890	9/13/08	34567
62890	9/13/07	12345
62890	9/13/11	22345
;
run;
proc sort data=portfolio;
by mgrno descending announcement;
run;
proc sort data=import2;
by mgrno descending fdate;
run;
data temp;
 set portfolio(rename=(announcement=fdate) in=ina) import2(in=inb);
 by mgrno descending fdate;
 retain want;
 if first.mgrno then call missing(want);
 if ina then want=fdate;
 if inb;
format want mmddyy10.;
run;
data want;
 set temp(where=(want is not missing));
 by mgrno want fdate notsorted;
 if first.want then n=0;
 n+first.fdate;
 if n=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Jun 2017 12:37:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363396#M86047</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-06-01T12:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363571#M86109</link>
      <description>&lt;P&gt;Your replies are really, really helpful,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;. Thanks very much for your explanations.&lt;BR /&gt;&lt;BR /&gt;Also, thanks to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;for providing help.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 19:17:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363571#M86109</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-06-01T19:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363780#M86182</link>
      <description>&lt;P&gt;one more thing need to clarify.&lt;/P&gt;
&lt;P&gt;if there are no fdate between two announcement, then will retrun the last announcement.&lt;/P&gt;
&lt;P&gt;E.X.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token data string"&gt;9385	9/15/08
9385	9/16/08
&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the second one will be ignored .&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 12:49:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/363780#M86182</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-06-02T12:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/364427#M86442</link>
      <description>&lt;P&gt;I see. That is good to know. So there will be only one observation&amp;nbsp;(i.e., the last announcement) whenever fdate is not between announcements.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 00:49:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/364427#M86442</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-06-06T00:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an alternative to in( ) in Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/364452#M86445</link>
      <description>&lt;P&gt;These two small modifications halve the elapse time on my machine:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;U&gt;&lt;FONT size="3"&gt; tempv/&lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;view&lt;/FONT&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&lt;U&gt;=tempv&lt;/U&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="3"&gt;&amp;nbsp;set&lt;/FONT&gt;&lt;FONT size="3"&gt; portfolio(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;rename&lt;/FONT&gt;&lt;FONT size="3"&gt;=(announcement=fdate) &lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;in&lt;/FONT&gt;&lt;FONT size="3"&gt;=ina) import2(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;in&lt;/FONT&gt;&lt;FONT size="3"&gt;=inb);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="3"&gt;&amp;nbsp;by&lt;/FONT&gt;&lt;FONT size="3"&gt; mgrno &lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;descending&lt;/FONT&gt;&lt;FONT size="3"&gt; fdate;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="3"&gt;&amp;nbsp;retain&lt;/FONT&gt;&lt;FONT size="3"&gt; want;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="3"&gt;&amp;nbsp;if&lt;/FONT&gt;&lt;FONT size="3"&gt; first.mgrno &lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;then&lt;/FONT&gt; &lt;FONT color="#0000ff" size="3"&gt;call&lt;/FONT&gt;&lt;FONT size="3"&gt; missing(want);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="3"&gt;&amp;nbsp;if&lt;/FONT&gt;&lt;FONT size="3"&gt; ina &lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;then&lt;/FONT&gt;&lt;FONT size="3"&gt; want=fdate;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="3"&gt;&amp;nbsp;if&lt;/FONT&gt;&lt;FONT size="3"&gt; inb &lt;U&gt;&lt;STRONG&gt;&amp;amp; want;&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="3"&gt;&amp;nbsp;format&lt;/FONT&gt;&lt;FONT size="3"&gt; want &lt;/FONT&gt;&lt;FONT color="#008080" size="3"&gt;mmddyy10.&lt;/FONT&gt;&lt;FONT size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="3"&gt; want;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="3"&gt;&amp;nbsp;set&lt;/FONT&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&lt;U&gt; tempv&lt;/U&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="3"&gt;&amp;nbsp;by&lt;/FONT&gt;&lt;FONT size="3"&gt; mgrno fdate &lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;notsorted&lt;/FONT&gt;&lt;FONT size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="3"&gt;&amp;nbsp;if&lt;/FONT&gt;&lt;FONT size="3"&gt; first.mgrno &lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;then&lt;/FONT&gt;&lt;FONT size="3"&gt; n=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;n+first.fdate;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="3"&gt;&amp;nbsp;if&lt;/FONT&gt;&lt;FONT size="3"&gt; n=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 03:46:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Is-there-an-alternative-to-in-in-Proc-SQL/m-p/364452#M86445</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-06-06T03:46:17Z</dc:date>
    </item>
  </channel>
</rss>

