<?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 split huge data into multiple datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-split-huge-data-into-multiple-datasets/m-p/614218#M179484</link>
    <description>&lt;P&gt;What is the logic here? The 20% in the first data set, is that the first 20% of the data from the original data or?&lt;/P&gt;</description>
    <pubDate>Sat, 28 Dec 2019 17:35:00 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-12-28T17:35:00Z</dc:date>
    <item>
      <title>how to split huge data into multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-split-huge-data-into-multiple-datasets/m-p/614217#M179483</link>
      <description>&lt;P&gt;Hi Good Evening&amp;nbsp;&lt;/P&gt;&lt;P&gt;suppose&amp;nbsp; i have huge data in a single dataset so i want to split that data into multiple datasets following&lt;/P&gt;&lt;P&gt;first dataset 20%&lt;/P&gt;&lt;P&gt;second dataset 50%&lt;/P&gt;&lt;P&gt;third dataset 30%&lt;/P&gt;&lt;P&gt;accordingly&amp;nbsp; remaing data should be existing dataset how we can do this problem&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2019 17:26:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-split-huge-data-into-multiple-datasets/m-p/614217#M179483</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2019-12-28T17:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to split huge data into multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-split-huge-data-into-multiple-datasets/m-p/614218#M179484</link>
      <description>&lt;P&gt;What is the logic here? The 20% in the first data set, is that the first 20% of the data from the original data or?&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2019 17:35:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-split-huge-data-into-multiple-datasets/m-p/614218#M179484</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-12-28T17:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to split huge data into multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-split-huge-data-into-multiple-datasets/m-p/614219#M179485</link>
      <description>&lt;P&gt;If so then do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   do x=1 to 1e7;
      y=rand('uniform', 1, 100);
      output;
   end;
run;

data one two three;
   set have nobs=nobs;
   if           _N_/nobs &amp;lt;= .2 then output one;
   else if .2 &amp;lt; _N_/nobs &amp;lt;= .5 then output two;
   else                             output three;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Dec 2019 17:45:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-split-huge-data-into-multiple-datasets/m-p/614219#M179485</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-12-28T17:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to split huge data into multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-split-huge-data-into-multiple-datasets/m-p/614229#M179488</link>
      <description>&lt;P&gt;If you have a realy huge file and you want to deal with part of it fast&lt;/P&gt;
&lt;P&gt;you should consider using SPDE engine, that is&lt;/P&gt;
&lt;P&gt;1) Allocate a SPDE engine library&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mylib spde '/disk1/spdedata';
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2) Copy or move your dataset using a datastep or proc copy to the new library.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Read more in sas documentation.&amp;nbsp;&amp;nbsp;&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;</description>
      <pubDate>Sat, 28 Dec 2019 21:18:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-split-huge-data-into-multiple-datasets/m-p/614229#M179488</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-12-28T21:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to split huge data into multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-split-huge-data-into-multiple-datasets/m-p/614233#M179490</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;Why split the original into multiple data sets and waste disk space if you can create a number of views with the FIRSTOBS= OBS= data set option valued according to the required percentage? Of course, you don't have to do it manually:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have  ;                                                                                                                            
  RID + 1 ;                                                                                                                             
  set sashelp.cars ;                                                                                                                    
run ;                                                                                                                                   
                                                                                                                                        
data _null_ ;                                                                                                                           
  array pct p1-p3 (20 50 30) ;                                                                                                          
  lo = 1 ;                                                                                                                              
  do over pct ;                                                                                                                         
    cpct + pct ;                                                                                                                        
    hi = ceil (cpct * divide (n, 100)) ;                                                                                                
    call execute (catx (" ", cats ("data v", _i_), "/", cats ("view=v", _i_), ";")) ;                                                   
    call execute (catx (" ", "set have (firstobs=", lo, "obs=", hi, ") ;")) ;                                                           
    call execute ("run ;") ;                                                                                                            
    lo = hi + 1 ;                                                                                                                       
  end ;                                                                                                                                 
  stop ;                                                                                                                                
  set have nobs = n ;                                                                                                                   
run ;                
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When this code has run, you'll see this story in the log:&lt;/P&gt;
&lt;PRE&gt;1   + data v1 / view=v1 ;                                                                                                               
2   + set have (firstobs= 1 obs= 86 ) ;                                                                                                 
3   + run ;                                                                                                                             
NOTE: DATA STEP view saved on file WORK.V1.                                                                                             
                                                                                                                                        
4   + data v2 / view=v2 ;                                                                                                               
5   + set have (firstobs= 87 obs= 300 ) ;                                                                                               
6   + run ;                                                                                                                             
NOTE: DATA STEP view saved on file WORK.V2.                                                                                             
                                                                                                                                        
7   + data v3 / view=v3 ;                                                                                                               
8   + set have (firstobs= 301 obs= 428 ) ;                                                                                              
9   + run ;                                                                                                                             
NOTE: DATA STEP view saved on file WORK.V3. 
&lt;/PRE&gt;
&lt;P&gt;Now whenever you want to process part #1 of your original file, just read view V1, and so forth.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, instead of creating the views, you can create 3 sets of from-to macro variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_ ;                                                                                                                           
  array pct p1-p3 (20 50 30) ;                                                                                                          
  lo = 1 ;                                                                                                                              
  do over pct ;                                                                                                                         
    cpct + pct ;                                                                                                                        
    hi = ceil (cpct * divide (n, 100)) ;                                                                                                
    call symputx (cats ("lo", _i_), lo) ;                                                                                               
    call symputx (cats ("hi", _i_), hi) ;                                                                                               
    lo = hi + 1 ;                                                                                                                       
  end ;                                                                                                                                 
  stop ;                                                                                                                                
  set have nobs = n ;                                                                                                                   
run ;       
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now if you want to process the specific parts of your file you'd reference the original file respectively as:&lt;/P&gt;
&lt;PRE&gt;  have (firstobs = &amp;amp;lo1 obs = &amp;amp;hi1) 
  have (firstobs = &amp;amp;lo2 obs = &amp;amp;hi2) 
  have (firstobs = &amp;amp;lo3 obs = &amp;amp;hi3) 
&lt;/PRE&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;Paul D.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2019 22:42:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-split-huge-data-into-multiple-datasets/m-p/614233#M179490</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2019-12-28T22:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to split huge data into multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-split-huge-data-into-multiple-datasets/m-p/614243#M179493</link>
      <description>&lt;P&gt;Thank You sir&lt;/P&gt;&lt;P&gt;for your valuable point&amp;nbsp; i&lt;/P&gt;</description>
      <pubDate>Sun, 29 Dec 2019 03:33:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-split-huge-data-into-multiple-datasets/m-p/614243#M179493</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2019-12-29T03:33:09Z</dc:date>
    </item>
  </channel>
</rss>

