<?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 Creating tables for each variable in a parent table and limit rows output. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-tables-for-each-variable-in-a-parent-table-and-limit/m-p/514749#M138820</link>
    <description>&lt;P&gt;Hi all, I'm trying to create a table for each version of a variable in a parent table. Currently I am using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%let TABLE=libref.tablename
%let COLUMN=columnname

proc sql noprint;
select distinct
cat("DATA out_",compress(&amp;amp;COLUMN.,'','kad'),
";set &amp;amp;TABLE.(where=(&amp;amp;COLUMN.='" ,&amp;amp;COLUMN.,
" ')); run;") length=500 into :allsteps separated by ';'
from &amp;amp;TABLE.;
quit;
%macro runSteps;
&amp;amp;allsteps.;
%mend;
%runSteps;&lt;/PRE&gt;&lt;P&gt;My problem is that I would like to limit to rows of the output tables to a certain number say 5. But I can't quite figure out how to fit obsout into this code. Putting it in the proc sql statement just prevents the looping of of the runSteps macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
    <pubDate>Tue, 20 Nov 2018 13:59:22 GMT</pubDate>
    <dc:creator>puregallus</dc:creator>
    <dc:date>2018-11-20T13:59:22Z</dc:date>
    <item>
      <title>Creating tables for each variable in a parent table and limit rows output.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-tables-for-each-variable-in-a-parent-table-and-limit/m-p/514749#M138820</link>
      <description>&lt;P&gt;Hi all, I'm trying to create a table for each version of a variable in a parent table. Currently I am using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%let TABLE=libref.tablename
%let COLUMN=columnname

proc sql noprint;
select distinct
cat("DATA out_",compress(&amp;amp;COLUMN.,'','kad'),
";set &amp;amp;TABLE.(where=(&amp;amp;COLUMN.='" ,&amp;amp;COLUMN.,
" ')); run;") length=500 into :allsteps separated by ';'
from &amp;amp;TABLE.;
quit;
%macro runSteps;
&amp;amp;allsteps.;
%mend;
%runSteps;&lt;/PRE&gt;&lt;P&gt;My problem is that I would like to limit to rows of the output tables to a certain number say 5. But I can't quite figure out how to fit obsout into this code. Putting it in the proc sql statement just prevents the looping of of the runSteps macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 13:59:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-tables-for-each-variable-in-a-parent-table-and-limit/m-p/514749#M138820</guid>
      <dc:creator>puregallus</dc:creator>
      <dc:date>2018-11-20T13:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: Creating tables for each variable in a parent table and limit rows output.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-tables-for-each-variable-in-a-parent-table-and-limit/m-p/514757#M138824</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with call execute in a data step :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let table=sashelp.class;
%let column=age;

data _NULL_;
input age;
call execute(cats('data out_',&amp;amp;column.,'; set &amp;amp;table.; where &amp;amp;column.=',&amp;amp;column.,'; if _N_ le 3; run;'));
cards;
12
13
14
15
16
;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Nov 2018 14:23:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-tables-for-each-variable-in-a-parent-table-and-limit/m-p/514757#M138824</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-11-20T14:23:31Z</dc:date>
    </item>
  </channel>
</rss>

