<?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: Point= option &amp; By statement in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Point-option-By-statement/m-p/149986#M2530</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why not to use a merge ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;merge have have(firstobs=2 rename=(x=x_next n=n_next));&lt;/P&gt;&lt;P&gt;If n ne n_next then Call Missing (X_Next);&lt;BR /&gt;drop n_next;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Sep 2014 07:55:36 GMT</pubDate>
    <dc:creator>Loko</dc:creator>
    <dc:date>2014-09-18T07:55:36Z</dc:date>
    <item>
      <title>Point= option &amp; By statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Point-option-By-statement/m-p/149985#M2529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to get the following observations of a data set by groups. The - working (?) - solution would be this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data Have;&lt;BR /&gt;&amp;nbsp; Input N $ X @@;&lt;BR /&gt;&amp;nbsp; Datalines ;&lt;BR /&gt;&amp;nbsp; A 1 A 3 A 6 B 2 B 9 B 9 C 1 C 5 C 6 C 7 C 8&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;Data Want;&lt;BR /&gt;&amp;nbsp; Obs=_N_+1;&lt;BR /&gt;&amp;nbsp; Set Have End=Eof;&lt;BR /&gt;&amp;nbsp; By N; /* Can I do this? */&lt;BR /&gt;&amp;nbsp; If not EoF Then Set Have (Keep=X Rename=(X=X_Next)) Point=Obs; &lt;BR /&gt;&amp;nbsp; Else Call Missing (X_Next);&lt;BR /&gt;&amp;nbsp; If Last.N Then Call Missing (X_Next);&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, in the documentation it says (&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000173782.htm" title="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000173782.htm"&gt;SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition&lt;/A&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE cellpadding="4" cellspacing="2"&gt;&lt;TBODY&gt;&lt;TR valign="top"&gt;&lt;TD align="left" class="label" nowrap="nowrap" width="95"&gt;Restriction:&lt;/TD&gt;&lt;TD align="left" class="bgBlockLight"&gt;&lt;A name="a000855756"&gt;&lt;/A&gt;You cannot use POINT= with a BY statement, a WHERE statement, or a WHERE= data set option. In addition, you cannot use it with transport format data sets, data sets in sequential format on tape or disk, and SAS/ACCESS views or the SQL procedure views that read data from external files.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The solution is required to be reliable. My question is: Is this combination of point and by o.k.?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&amp;amp;kind regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 06:08:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Point-option-By-statement/m-p/149985#M2529</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2014-09-18T06:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Point= option &amp; By statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Point-option-By-statement/m-p/149986#M2530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why not to use a merge ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;merge have have(firstobs=2 rename=(x=x_next n=n_next));&lt;/P&gt;&lt;P&gt;If n ne n_next then Call Missing (X_Next);&lt;BR /&gt;drop n_next;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 07:55:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Point-option-By-statement/m-p/149986#M2530</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2014-09-18T07:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: Point= option &amp; By statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Point-option-By-statement/m-p/149987#M2531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your datastep is OK.&lt;/P&gt;&lt;P&gt;There are other methods to implement look ahead in a data step, but I like your version as well. &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;&lt;/P&gt;&lt;P&gt;see:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sascommunity.org/wiki/Look-Ahead_and_Look-Back" title="http://www.sascommunity.org/wiki/Look-Ahead_and_Look-Back"&gt;Look-Ahead and Look-Back - sasCommunity&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 08:02:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Point-option-By-statement/m-p/149987#M2531</guid>
      <dc:creator>gergely_batho</dc:creator>
      <dc:date>2014-09-18T08:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Point= option &amp; By statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Point-option-By-statement/m-p/149988#M2532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes your coding is a valid approach. It is thinking about:&lt;/P&gt;&lt;P&gt;-&amp;nbsp; what happens with the PDV&lt;/P&gt;&lt;P&gt;- automatic advancing of records&lt;/P&gt;&lt;P&gt;- at what level the internal housekeeping is done&lt;/P&gt;&lt;P&gt;Your by step is working with the first set statement, there is no point defined.&lt;/P&gt;&lt;P&gt;You second set statement is having different options it acts sepeartely. You could use a table lookup (example 8 Set statement) &lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/67407/HTML/default/viewer.htm#p00hxg3x8lwivcn1f0e9axziw57y.htm" title="http://support.sas.com/documentation/cdl/en/lestmtsref/67407/HTML/default/viewer.htm#p00hxg3x8lwivcn1f0e9axziw57y.htm"&gt;SAS(R) 9.4 Statements: Reference, Third Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Using an index is an binary search on some values and than jumping to the complete record using a point / direct access. Using the point is thinking in an own indexed way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A very nice paper is: &lt;A href="http://support.sas.com/resources/papers/proceedings09/038-2009.pdf" title="http://support.sas.com/resources/papers/proceedings09/038-2009.pdf"&gt;http://support.sas.com/resources/papers/proceedings09/038-2009.pdf&lt;/A&gt;&amp;nbsp; The double dow loop is using the different internal householding to restart calculations within an ordered group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why would you use these kind of constructs? &lt;/P&gt;&lt;P&gt;They can be much faster in execution time and resource usage common known constructs including SQL. It the reason of the hyping of NOSQL.&lt;/P&gt;&lt;P&gt;The disadvantage is that you have analyze your problem very well to understand what should be done and than the coding part takes more effort and verifying.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 09:08:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Point-option-By-statement/m-p/149988#M2532</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-09-18T09:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Point= option &amp; By statement</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Point-option-By-statement/m-p/149989#M2533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is two solution . one is using routine CALL SET () .&amp;nbsp; another is making a flag variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data want;
 set have;
 by n;
 next=.; 
retain dsid;
 if _n_ eq 1 then dsid=open('have(keep=x rename=(x=next))','i');
&amp;nbsp; call set(dsid);
 if not last.n then rc=fetchobs(dsid,_n_+1);
&amp;nbsp; run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;

Data Have;
&amp;nbsp; Input N $ X @@;
&amp;nbsp; Datalines ;
&amp;nbsp; A 1 A 3 A 6 B 2 B 9 B 9 C 1 C 5 C 6 C 7 C 8
&amp;nbsp; ;
Run;


proc sort data=have;by n;run;
data want;
 set have nobs=nobs end=last;
 if _n_ ne nobs then do;
&amp;nbsp; obs=_n_+1;
&amp;nbsp; set have(Rename=(n=_n X=X_Next)) point=obs ;
 end;
&amp;nbsp; If n ne _n or last Then Call Missing (X_Next);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 14:14:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Point-option-By-statement/m-p/149989#M2533</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-09-18T14:14:43Z</dc:date>
    </item>
  </channel>
</rss>

