<?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: Report request obs from dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Report-request-obs-from-dataset/m-p/68864#M14953</link>
    <description>&amp;gt; data want;&lt;BR /&gt;
&amp;gt;  set sashelp.class;&lt;BR /&gt;
&amp;gt; if _n_ in ( 2,4,8:12);&lt;BR /&gt;
&amp;gt; run;&lt;BR /&gt;
&amp;gt;  &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Which extract 2th,4th, and 8 - 12 obs&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Ksharp&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
ok, but&lt;BR /&gt;
if the table from which certain rows are read is large, your method will read the whole table, and the alternative I suggested (POINT= option on SET statement) reads only requested rows when used like&lt;BR /&gt;
data want ;&lt;BR /&gt;
  do pointer = 2,4,8 to 12, 1000 ;&lt;BR /&gt;
      set your.table point= pointer ;&lt;BR /&gt;
      from_row=pointer ; *the variable "pointer" cannot be kept because it is named by a statement option!;&lt;BR /&gt;
      if  _error_ then _error_ =0 ;&lt;BR /&gt;
      else output ;&lt;BR /&gt;
  end ;&lt;BR /&gt;
  stop;&lt;BR /&gt;
run ;&lt;BR /&gt;
the test for _error_ catches the accident of pointing to rows which are not there because they are already marked as deleted or pointing to a row beyond the end of file.&lt;BR /&gt;
Replacing "your.table" above with sashelp.class, here is the SASlog[pre]633  data want ;&lt;BR /&gt;
634    do pointer = 2,4,8 to 12, 1000 ;&lt;BR /&gt;
635        set sashelp.class point= pointer ;&lt;BR /&gt;
636        point=pointer ; *the variable "pointer" cannot be kept because it is named by a statement option!;&lt;BR /&gt;
637        if  _error_ then _error_ =0 ;&lt;BR /&gt;
638        else output ;&lt;BR /&gt;
639    end ;&lt;BR /&gt;
640    stop;&lt;BR /&gt;
641  run ;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The data set WORK.WANT has 7 observations and 6 variables.&lt;BR /&gt;
NOTE: DATA statement used[/pre]&lt;BR /&gt;
and a listing[pre]point selections                 12:08 Thursday, February 23, 2011   1&lt;BR /&gt;
&lt;BR /&gt;
Obs    Name       Sex    Age    Height    Weight    point&lt;BR /&gt;
&lt;BR /&gt;
 1     Alice       F      13     56.5       84.0       2&lt;BR /&gt;
 2     Carol       F      14     62.8      102.5       4&lt;BR /&gt;
 3     Janet       F      15     62.5      112.5       8&lt;BR /&gt;
 4     Jeffrey     M      13     62.5       84.0       9&lt;BR /&gt;
 5     John        M      12     59.0       99.5      10&lt;BR /&gt;
 6     Joyce       F      11     51.3       50.5      11&lt;BR /&gt;
 7     Judy        F      14     64.3       90.0      12</description>
    <pubDate>Wed, 23 Feb 2011 15:43:41 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2011-02-23T15:43:41Z</dc:date>
    <item>
      <title>Report request obs from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-request-obs-from-dataset/m-p/68861#M14950</link>
      <description>If a dataset contain 200 observations, how to report obs no 29, 46, 89 and 185&lt;BR /&gt;
using base sas and proc sql. Thanks in advance</description>
      <pubDate>Thu, 03 Feb 2011 18:16:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-request-obs-from-dataset/m-p/68861#M14950</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2011-02-03T18:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Report request obs from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-request-obs-from-dataset/m-p/68862#M14951</link>
      <description>if you have nothing more to use as a filter than the obs no, then look at the point= option odf the SET statement. This is not available to proc sql .</description>
      <pubDate>Thu, 03 Feb 2011 18:27:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-request-obs-from-dataset/m-p/68862#M14951</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-02-03T18:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: Report request obs from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-request-obs-from-dataset/m-p/68863#M14952</link>
      <description>[pre]&lt;BR /&gt;
data want;&lt;BR /&gt;
 set sashelp.class;&lt;BR /&gt;
 if _n_ in ( 2,4,8:12);&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Which extract 2th,4th, and 8 - 12 obs&lt;BR /&gt;
&lt;BR /&gt;
Ksharp

Message was edited by: Ksharp</description>
      <pubDate>Wed, 23 Feb 2011 05:23:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-request-obs-from-dataset/m-p/68863#M14952</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-02-23T05:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Report request obs from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-request-obs-from-dataset/m-p/68864#M14953</link>
      <description>&amp;gt; data want;&lt;BR /&gt;
&amp;gt;  set sashelp.class;&lt;BR /&gt;
&amp;gt; if _n_ in ( 2,4,8:12);&lt;BR /&gt;
&amp;gt; run;&lt;BR /&gt;
&amp;gt;  &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Which extract 2th,4th, and 8 - 12 obs&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Ksharp&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
ok, but&lt;BR /&gt;
if the table from which certain rows are read is large, your method will read the whole table, and the alternative I suggested (POINT= option on SET statement) reads only requested rows when used like&lt;BR /&gt;
data want ;&lt;BR /&gt;
  do pointer = 2,4,8 to 12, 1000 ;&lt;BR /&gt;
      set your.table point= pointer ;&lt;BR /&gt;
      from_row=pointer ; *the variable "pointer" cannot be kept because it is named by a statement option!;&lt;BR /&gt;
      if  _error_ then _error_ =0 ;&lt;BR /&gt;
      else output ;&lt;BR /&gt;
  end ;&lt;BR /&gt;
  stop;&lt;BR /&gt;
run ;&lt;BR /&gt;
the test for _error_ catches the accident of pointing to rows which are not there because they are already marked as deleted or pointing to a row beyond the end of file.&lt;BR /&gt;
Replacing "your.table" above with sashelp.class, here is the SASlog[pre]633  data want ;&lt;BR /&gt;
634    do pointer = 2,4,8 to 12, 1000 ;&lt;BR /&gt;
635        set sashelp.class point= pointer ;&lt;BR /&gt;
636        point=pointer ; *the variable "pointer" cannot be kept because it is named by a statement option!;&lt;BR /&gt;
637        if  _error_ then _error_ =0 ;&lt;BR /&gt;
638        else output ;&lt;BR /&gt;
639    end ;&lt;BR /&gt;
640    stop;&lt;BR /&gt;
641  run ;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The data set WORK.WANT has 7 observations and 6 variables.&lt;BR /&gt;
NOTE: DATA statement used[/pre]&lt;BR /&gt;
and a listing[pre]point selections                 12:08 Thursday, February 23, 2011   1&lt;BR /&gt;
&lt;BR /&gt;
Obs    Name       Sex    Age    Height    Weight    point&lt;BR /&gt;
&lt;BR /&gt;
 1     Alice       F      13     56.5       84.0       2&lt;BR /&gt;
 2     Carol       F      14     62.8      102.5       4&lt;BR /&gt;
 3     Janet       F      15     62.5      112.5       8&lt;BR /&gt;
 4     Jeffrey     M      13     62.5       84.0       9&lt;BR /&gt;
 5     John        M      12     59.0       99.5      10&lt;BR /&gt;
 6     Joyce       F      11     51.3       50.5      11&lt;BR /&gt;
 7     Judy        F      14     64.3       90.0      12</description>
      <pubDate>Wed, 23 Feb 2011 15:43:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-request-obs-from-dataset/m-p/68864#M14953</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-02-23T15:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: Report request obs from dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-request-obs-from-dataset/m-p/68865#M14954</link>
      <description>OK.&lt;BR /&gt;
Peter , Your right. Assuming the dataset OP has is not large.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
Ksharp

Message was edited by: Ksharp</description>
      <pubDate>Fri, 25 Feb 2011 05:15:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-request-obs-from-dataset/m-p/68865#M14954</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-02-25T05:15:01Z</dc:date>
    </item>
  </channel>
</rss>

