<?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 Limiting output for each select statement within one create table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Limiting-output-for-each-select-statement-within-one-create/m-p/337423#M76614</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a SAS code that looks like this:&lt;/P&gt;&lt;PRE&gt;PROC SQL;
create table CombinedSample as
	(select account_number, 'Cell1' as seed 
		from Dataset1
	where age between 16 and 34)

union 

(select account_number, 'Cell2' as seed
		from Dataset1
	where age between 35 and 54)
;
QUIT;&lt;/PRE&gt;&lt;P&gt;I have 10 or more similar select statements that will be included in the code. My question is how can I limit the output for each &amp;nbsp;select statement? &amp;nbsp;For example, for Cell1 i only need 50 and for Cell2 128, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Someone here used limit statements but it only works on AQT.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TIA!&lt;/P&gt;</description>
    <pubDate>Thu, 02 Mar 2017 15:57:18 GMT</pubDate>
    <dc:creator>jigsatics</dc:creator>
    <dc:date>2017-03-02T15:57:18Z</dc:date>
    <item>
      <title>Limiting output for each select statement within one create table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-output-for-each-select-statement-within-one-create/m-p/337423#M76614</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a SAS code that looks like this:&lt;/P&gt;&lt;PRE&gt;PROC SQL;
create table CombinedSample as
	(select account_number, 'Cell1' as seed 
		from Dataset1
	where age between 16 and 34)

union 

(select account_number, 'Cell2' as seed
		from Dataset1
	where age between 35 and 54)
;
QUIT;&lt;/PRE&gt;&lt;P&gt;I have 10 or more similar select statements that will be included in the code. My question is how can I limit the output for each &amp;nbsp;select statement? &amp;nbsp;For example, for Cell1 i only need 50 and for Cell2 128, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Someone here used limit statements but it only works on AQT.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TIA!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 15:57:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-output-for-each-select-statement-within-one-create/m-p/337423#M76614</guid>
      <dc:creator>jigsatics</dc:creator>
      <dc:date>2017-03-02T15:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting output for each select statement within one create table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-output-for-each-select-statement-within-one-create/m-p/337426#M76616</link>
      <description>&lt;P&gt;And you don't care which rows they are, as long as there are only 50, for example, in the first query?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know what all the other queries look like, but for what you've shown, try adding the following to the where statement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
create table CombinedSample as
	(select account_number, 'Cell1' as seed 
		from Dataset1
	where age between 16 and 34 AND
                  monotonic() &amp;lt;= 50)

union &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Mar 2017 16:04:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-output-for-each-select-statement-within-one-create/m-p/337426#M76616</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-03-02T16:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting output for each select statement within one create table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-output-for-each-select-statement-within-one-create/m-p/337427#M76617</link>
      <description>&lt;P&gt;Try the inobs= or outobs= options e.g.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql outobs=3;
	create table classmall
	as select *
	from sashelp.class
	where sex='M';
quit;

proc sql inobs=3;
	create table classmall
	as select *
	from sashelp.class
	where sex='M';
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Mar 2017 16:08:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-output-for-each-select-statement-within-one-create/m-p/337427#M76617</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2017-03-02T16:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting output for each select statement within one create table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-output-for-each-select-statement-within-one-create/m-p/337437#M76622</link>
      <description>&lt;P&gt;The other queries will be similar to the first 2 but with a slightly different where statement. The idea is to get a random 50. Does the monotonic function randomly pick 50?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 16:29:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-output-for-each-select-statement-within-one-create/m-p/337437#M76622</guid>
      <dc:creator>jigsatics</dc:creator>
      <dc:date>2017-03-02T16:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting output for each select statement within one create table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-output-for-each-select-statement-within-one-create/m-p/337468#M76630</link>
      <description>&lt;P&gt;Do it after, with surveyselect. Stratify with seed. You will have full control of sample sizes and the assurance that observations are selected randomly.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 17:33:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-output-for-each-select-statement-within-one-create/m-p/337468#M76630</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-03-02T17:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting output for each select statement within one create table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Limiting-output-for-each-select-statement-within-one-create/m-p/337482#M76635</link>
      <description>&lt;P&gt;Given what you want, PGStats approach is the right way to go.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 18:09:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Limiting-output-for-each-select-statement-within-one-create/m-p/337482#M76635</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-03-02T18:09:51Z</dc:date>
    </item>
  </channel>
</rss>

