<?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 Limit function in SAS in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420588#M27047</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a simple was to do a Limit function in proc sql like I would do in MySQL? I just want to limit the number of row returned (like first 100 or a random&amp;nbsp;assortment&amp;nbsp;equaling 100).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would have just tagged this at the end of a statement (see below), but it did not work in SAS EG. When I google it, I see forums with all of these elaborate methods to get the results but I want something simple if it exists.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;limit 100;&amp;nbsp;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 12 Dec 2017 21:11:45 GMT</pubDate>
    <dc:creator>Dogo23</dc:creator>
    <dc:date>2017-12-12T21:11:45Z</dc:date>
    <item>
      <title>Limit function in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420588#M27047</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a simple was to do a Limit function in proc sql like I would do in MySQL? I just want to limit the number of row returned (like first 100 or a random&amp;nbsp;assortment&amp;nbsp;equaling 100).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would have just tagged this at the end of a statement (see below), but it did not work in SAS EG. When I google it, I see forums with all of these elaborate methods to get the results but I want something simple if it exists.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;limit 100;&amp;nbsp;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 21:11:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420588#M27047</guid>
      <dc:creator>Dogo23</dc:creator>
      <dc:date>2017-12-12T21:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Limit function in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420595#M27050</link>
      <description>&lt;P&gt;Option obs=1000;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But....if you sort a data set without specifying an OUT= data this will destroy the original data.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 21:16:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420595#M27050</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-12-12T21:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Limit function in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420598#M27051</link>
      <description>&lt;P&gt;THe INOBS and OUTOBS options are probably what you need. You can also OBS = 100 on individual SAS datasets to limit the number of rows read:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table want
  as select *
  from have (obs = 100)
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Dec 2017 21:17:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420598#M27051</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-12-12T21:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Limit function in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420608#M27054</link>
      <description>&lt;P&gt;So when I applied that, I only got a single record back.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 21:33:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420608#M27054</guid>
      <dc:creator>Dogo23</dc:creator>
      <dc:date>2017-12-12T21:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: Limit function in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420610#M27055</link>
      <description>&lt;P&gt;Include your code and log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 21:35:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420610#M27055</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-12-12T21:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Limit function in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420615#M27056</link>
      <description>&lt;P&gt;proc sql;&lt;BR /&gt;create table city_residents&amp;nbsp;as&lt;BR /&gt;select&lt;BR /&gt;a.salutation_title,&lt;BR /&gt;a.first_name,&lt;BR /&gt;a.last_name,&lt;BR /&gt;a.suffix,&lt;BR /&gt;a.address_line1,&lt;BR /&gt;a.address_line2,&lt;BR /&gt;a.city,&lt;BR /&gt;a.state_province,&lt;BR /&gt;a.zip_code&lt;/P&gt;&lt;P&gt;from&amp;nbsp;table1&amp;nbsp;(obs = 100) a&lt;BR /&gt;inner join&lt;BR /&gt;table2&amp;nbsp;b&lt;BR /&gt;on a.zip_id = b.mc_zip_id&lt;BR /&gt;inner join&lt;BR /&gt;table3&amp;nbsp;c&lt;BR /&gt;on a.&lt;SPAN&gt;individual_num&lt;/SPAN&gt; = c.individual_num&lt;BR /&gt;where a.pref_language_code = 'ENG'&lt;BR /&gt;and b.MSA_NAME like'%Nashville%'&lt;BR /&gt;and a.address_line1 &amp;lt;&amp;gt; ' '&lt;BR /&gt;and a.MAILABLE = 'Y'&lt;BR /&gt;and a.pref_language_code = 'ENG'&lt;BR /&gt;group by 1;&lt;BR /&gt;quit;&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;P&gt;NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR&lt;BR /&gt;21&lt;BR /&gt;22 GOPTIONS ACCESSIBLE;&lt;BR /&gt;23 proc sql;&lt;BR /&gt;24 create table locals as&lt;BR /&gt;25 select&lt;BR /&gt;26 a.salutation_title,&lt;BR /&gt;27 a.first_name,&lt;BR /&gt;28 a.last_name,&lt;BR /&gt;29 a.suffix,&lt;BR /&gt;30 a.address_line1,&lt;BR /&gt;31 a.address_line2,&lt;BR /&gt;32 a.city,&lt;BR /&gt;33 a.state_province,&lt;BR /&gt;34 a.zip_code&lt;BR /&gt;35 from table1 (obs = 100) a&lt;BR /&gt;36 inner join&lt;BR /&gt;37 table2 b&lt;BR /&gt;38 on a.mc_zip_id = b.mc_zip_id&lt;BR /&gt;39 inner join&lt;BR /&gt;40 table c&lt;BR /&gt;41 on a.INDIVIDUAL_NUM = c.INDIVIDUAL_NUM&lt;BR /&gt;42 where a.pref_language_code = 'ENG'&lt;BR /&gt;43 and b.MSA_NAME like'%Nashville%'&lt;BR /&gt;44 and a.address_line1 &amp;lt;&amp;gt; ' '&lt;BR /&gt;45 and a.MAILABLE = 'Y'&lt;BR /&gt;46 and a.pref_language_code = 'ENG'&lt;BR /&gt;47 or a.tier_name in ('Member', 'Discoverist') and c.qualifying_stays_last_12m &amp;gt;=1)&lt;BR /&gt;48 group by 1;&lt;BR /&gt;NOTE: The "&amp;lt;&amp;gt;" operator is interpreted as "not equals".&lt;BR /&gt;WARNING: A GROUP BY clause has been transformed into an ORDER BY clause because neither the SELECT clause nor the optional HAVING&lt;BR /&gt;clause of the associated table-expression referenced a summary function.&lt;BR /&gt;NOTE: Table WORK.LOCALS created, with 16 rows and 9 columns.&lt;/P&gt;&lt;P&gt;50 quit;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 4.84 seconds&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 21:52:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420615#M27056</guid>
      <dc:creator>Dogo23</dc:creator>
      <dc:date>2017-12-12T21:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Limit function in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420618#M27057</link>
      <description>&lt;P&gt;As you are doing inner join with few records, which is creating less number of records &lt;STRONG&gt;from&amp;nbsp;table1&amp;nbsp;(obs = 100)&lt;/STRONG&gt; a.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please remove obs = 100 and then do&lt;/P&gt;
&lt;P&gt;proc sql outobs = 100;&lt;BR /&gt;create table city_residents&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 22:12:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420618#M27057</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-12-12T22:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Limit function in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420621#M27058</link>
      <description>&lt;P&gt;Perfect! This was very helpful Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 22:17:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Limit-function-in-SAS/m-p/420621#M27058</guid>
      <dc:creator>Dogo23</dc:creator>
      <dc:date>2017-12-12T22:17:05Z</dc:date>
    </item>
  </channel>
</rss>

