<?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: dataset creation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/dataset-creation/m-p/237209#M268265</link>
    <description>That last step is a bit ugly, using OUTPUT with multiple data sets is a bit cleaner. I still stand by not using it.&lt;BR /&gt;&lt;BR /&gt;data out1 out2 out3 out4 out5 out6;&lt;BR /&gt;	set sashelp.heart;&lt;BR /&gt;	if ceil(_n_/26) =1 then output out1;&lt;BR /&gt;	else if ceil(_n_/26) =2 then output out2;&lt;BR /&gt;	else if ceil(_n_/26) =3 then output out3;&lt;BR /&gt;	else if ceil(_n_/26) =4 then output out4;&lt;BR /&gt;	else if ceil(_n_/26) =5 then output out5;&lt;BR /&gt;	else if ceil(_n_/26) =6 then output out6;&lt;BR /&gt;run;</description>
    <pubDate>Tue, 01 Dec 2015 16:59:52 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-12-01T16:59:52Z</dc:date>
    <item>
      <title>dataset creation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-creation/m-p/237184#M268262</link>
      <description>&lt;P&gt;&amp;nbsp;i have dataset of 6 variabes and 100 observations,if i want to create 5 datasets with minimum 26 observations from the existing dataset...how i can generate ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2015 15:56:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-creation/m-p/237184#M268262</guid>
      <dc:creator>aditri</dc:creator>
      <dc:date>2015-12-01T15:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: dataset creation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-creation/m-p/237188#M268263</link>
      <description>Generally not considered a good idea to split your dataset...You could use proc surveyselect so that you get random selections but that generates a single dataset that you'll have to split. Do you have any other rules besides a minimum of 26 variables?</description>
      <pubDate>Tue, 01 Dec 2015 16:11:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-creation/m-p/237188#M268263</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-12-01T16:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: dataset creation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-creation/m-p/237206#M268264</link>
      <description>&lt;P&gt;I would agree with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt; if you are trying to gather sample data sets, I would suggest utilizing the surveyselect procedure, as it will gather random samples of data.&amp;nbsp; You could do something like the following to ensure you don't have the same observations in each of the six data sets:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc surveyselect data=have out=want1
method=srs n=26;
run;

proc sql;
create table remain1 as
select A.*
from have A left join want1 B
on (A.ID=B.ID)
Where B.ID="";
quit;

proc surveyselect data=remain1 out=want2
method=srs n=26;
run;

proc sql;
create table remain2 as
select A.*
from remain1 A left join want2 B
on (A.ID=B.ID)
Where B.ID="";
quit;
.
.
.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, if you want to just create six different data sets with 26 observations in each (sequentially) the following code would do it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want1;
set have nobs=26;
run;

data want2;
set have (firstobs=27 obs=26);
run;

data want3;
set have (firstobs=54 obs=26);
run;

data want4;
set have (firstobs=81 obs=26);
run;

data want5;
set have (firstobs=108 obs=26);
run;

data want6;
set have (firstobs=135 obs=26);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Dec 2015 16:50:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-creation/m-p/237206#M268264</guid>
      <dc:creator>dcruik</dc:creator>
      <dc:date>2015-12-01T16:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: dataset creation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dataset-creation/m-p/237209#M268265</link>
      <description>That last step is a bit ugly, using OUTPUT with multiple data sets is a bit cleaner. I still stand by not using it.&lt;BR /&gt;&lt;BR /&gt;data out1 out2 out3 out4 out5 out6;&lt;BR /&gt;	set sashelp.heart;&lt;BR /&gt;	if ceil(_n_/26) =1 then output out1;&lt;BR /&gt;	else if ceil(_n_/26) =2 then output out2;&lt;BR /&gt;	else if ceil(_n_/26) =3 then output out3;&lt;BR /&gt;	else if ceil(_n_/26) =4 then output out4;&lt;BR /&gt;	else if ceil(_n_/26) =5 then output out5;&lt;BR /&gt;	else if ceil(_n_/26) =6 then output out6;&lt;BR /&gt;run;</description>
      <pubDate>Tue, 01 Dec 2015 16:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dataset-creation/m-p/237209#M268265</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-12-01T16:59:52Z</dc:date>
    </item>
  </channel>
</rss>

