<?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: How to select first few records to test the Proc sql; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-first-few-records-to-test-the-Proc-sql/m-p/7591#M103</link>
    <description>The only thing I could find that is remotely related is the use of FETCH in SQL Server and some other RDMS's to retrieve a result set into a cursor.&lt;BR /&gt;
&lt;BR /&gt;
What I could find in SAS's documentation was for FETCH to simply either retrieve the next observation from a SAS dataset that was "OPEN"ed or to retrieve a specific observation, by number (random access).</description>
    <pubDate>Wed, 19 Mar 2008 21:03:28 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2008-03-19T21:03:28Z</dc:date>
    <item>
      <title>How to select first few records to test the Proc sql;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-first-few-records-to-test-the-Proc-sql/m-p/7589#M101</link>
      <description>I remember the fetch statement can be used in proc sql to select first few rows of table to test the code.  I use following code but return an error message.&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table ab.temp as&lt;BR /&gt;
select a.policy_nbr, a.tx_date,  b.val&lt;BR /&gt;
from   ac.W_TC_TRANSS_F a, ac.w_lov_d b&lt;BR /&gt;
fetch first 100 rows only;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 19 Mar 2008 19:00:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-first-few-records-to-test-the-Proc-sql/m-p/7589#M101</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-03-19T19:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to select first few records to test the Proc sql;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-first-few-records-to-test-the-Proc-sql/m-p/7590#M102</link>
      <description>&lt;P&gt;I'm not familiar with Fetch but you can use inobs= or outobs= option on the PROC SQL statement.&lt;BR /&gt; &lt;BR /&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/69822/HTML/default/viewer.htm#p12ohgh32ffm6un13s7l2d5p9c8y.htm" target="_self"&gt;INOBS&lt;/A&gt;= restricts the number of rows from any of the input sources, so in your example if inobs=10 then the maximum number of rows used for input would be 10 for ac.W_TC_TRANSS_F and 10 for ac.w_lov_d b. Since you don't use a where clause in the example, you would return 100 rows. &amp;nbsp;If your library is a database table, SAS will push the correct instruction to the database to limit the amount of data it processes.&lt;BR /&gt; &lt;BR /&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/69822/HTML/default/viewer.htm#p12ohgh32ffm6un13s7l2d5p9c8y.htm" target="_self"&gt;OUTOBS&lt;/A&gt;= restricts the number of rows returned from your query, so outobs = 10 would return only the first 10 rows. &amp;nbsp;The full data is evaluated in the query, but the results set is limited in size, which might save on I/O from a database back to SAS. &amp;nbsp;Hope this helps.&lt;BR /&gt; &lt;BR /&gt; Linda&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &amp;gt; I remember the fetch statement can be used in proc&lt;BR /&gt; &amp;gt; sql to select first few rows of table to test the&lt;BR /&gt; &amp;gt; code. I use following code but return an error&lt;BR /&gt; &amp;gt; message.&lt;BR /&gt; &amp;gt; &lt;BR /&gt; &amp;gt; proc sql;&lt;BR /&gt; &amp;gt; create table ab.temp as&lt;BR /&gt; &amp;gt; select a.policy_nbr, a.tx_date, b.val&lt;BR /&gt; &amp;gt; from ac.W_TC_TRANSS_F a, ac.w_lov_d b&lt;BR /&gt; &amp;gt; fetch first 100 rows only;&lt;BR /&gt; &amp;gt; run;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 15:17:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-first-few-records-to-test-the-Proc-sql/m-p/7590#M102</guid>
      <dc:creator>LAP</dc:creator>
      <dc:date>2017-03-01T15:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to select first few records to test the Proc sql;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-first-few-records-to-test-the-Proc-sql/m-p/7591#M103</link>
      <description>The only thing I could find that is remotely related is the use of FETCH in SQL Server and some other RDMS's to retrieve a result set into a cursor.&lt;BR /&gt;
&lt;BR /&gt;
What I could find in SAS's documentation was for FETCH to simply either retrieve the next observation from a SAS dataset that was "OPEN"ed or to retrieve a specific observation, by number (random access).</description>
      <pubDate>Wed, 19 Mar 2008 21:03:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-first-few-records-to-test-the-Proc-sql/m-p/7591#M103</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-03-19T21:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to select first few records to test the Proc sql;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-first-few-records-to-test-the-Proc-sql/m-p/7592#M104</link>
      <description>There are 2 waya of dowing this&lt;BR /&gt;
&lt;BR /&gt;
1. Before giving proc sql command , you can specify options obs =10;&lt;BR /&gt;
&lt;BR /&gt;
or &lt;BR /&gt;
&lt;BR /&gt;
2. Inside proc sql, you can give rownum &amp;lt;11</description>
      <pubDate>Sat, 05 Apr 2008 14:55:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-first-few-records-to-test-the-Proc-sql/m-p/7592#M104</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-04-05T14:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to select first few records to test the Proc sql;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-first-few-records-to-test-the-Proc-sql/m-p/346612#M79956</link>
      <description>&lt;P&gt;When i try with Rownum ..i get the follwing error&lt;/P&gt;&lt;P&gt;ERROR: The following columns were not found in the contributing tables: rownum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With OBS &amp;nbsp;,,, no effect&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 10:16:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-first-few-records-to-test-the-Proc-sql/m-p/346612#M79956</guid>
      <dc:creator>srinidelite</dc:creator>
      <dc:date>2017-04-03T10:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to select first few records to test the Proc sql;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-first-few-records-to-test-the-Proc-sql/m-p/346896#M80036</link>
      <description>&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;SELECT * FROM mydata &lt;STRONG&gt;(OBS=10)&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 02:31:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-first-few-records-to-test-the-Proc-sql/m-p/346896#M80036</guid>
      <dc:creator>SimonJF</dc:creator>
      <dc:date>2017-04-04T02:31:22Z</dc:date>
    </item>
  </channel>
</rss>

