<?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: Create multiple dataset from source dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-dataset-from-source-dataset/m-p/455617#M115284</link>
    <description>&lt;P&gt;Very often the question first answered should be is it actually necessary to create multiple data sets. You can prepare reports using BY group processing for example to create separate pages/summaries for each level, or combinations of levels that way. Or use a WHERE statement to reduce data for a specific report to the department and/or employees of interest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Having the data in a single set may also be preferable if you have employees that change departments so you get all of the records at one time instead of having to then search among multiple data sets to get all of the records for employees.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Apr 2018 16:16:43 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-04-19T16:16:43Z</dc:date>
    <item>
      <title>Create multiple dataset from source dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-dataset-from-source-dataset/m-p/455616#M115283</link>
      <description>&lt;P&gt;I have a source dataset that have multiple departments. I want to create separate dataset for every departmet.&lt;/P&gt;
&lt;P&gt;I can do it by creating macro %Create_dept_data(dept_nm) then call this macro multiple time for every department dynamically.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any better way to do it in data step with out using macro.&lt;/P&gt;
&lt;P&gt;Note: there can be any number of department in have dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;input Dept $ EmployeeName $10.;&lt;BR /&gt;datalines;&lt;BR /&gt;HR Rocky&lt;BR /&gt;HR Samy&lt;BR /&gt;Finance Souley&lt;BR /&gt;Finance Boby&lt;BR /&gt;Admin John&lt;BR /&gt;Admin Ahmed&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Output&lt;BR /&gt;Three dataset&lt;BR /&gt;Dataset name: Hr&lt;BR /&gt;Hr Rocky&lt;BR /&gt;Hr Samy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dataset Name: Finance&lt;BR /&gt;Finance Souley&lt;BR /&gt;Finance Boby&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dataset Name:Finance&lt;BR /&gt;Admin John&lt;BR /&gt;Admin Ahmed&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 14:19:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-dataset-from-source-dataset/m-p/455616#M115283</guid>
      <dc:creator>RahulG</dc:creator>
      <dc:date>2018-04-19T14:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple dataset from source dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-dataset-from-source-dataset/m-p/455617#M115284</link>
      <description>&lt;P&gt;Very often the question first answered should be is it actually necessary to create multiple data sets. You can prepare reports using BY group processing for example to create separate pages/summaries for each level, or combinations of levels that way. Or use a WHERE statement to reduce data for a specific report to the department and/or employees of interest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Having the data in a single set may also be preferable if you have employees that change departments so you get all of the records at one time instead of having to then search among multiple data sets to get all of the records for employees.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 16:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-dataset-from-source-dataset/m-p/455617#M115284</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-19T16:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple dataset from source dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-dataset-from-source-dataset/m-p/455619#M115286</link>
      <description>&lt;P&gt;Splitting same data up into smaller blocks is rarely a good idea, and will make your programming X times harder.&lt;/P&gt;
&lt;P&gt;Now you can do it:&lt;/P&gt;
&lt;PRE&gt;proc sort data=have out=loop nodupkey;
  by dept;
run;
data _null_;
  set loop;
  call execute(cat('data ',strip(dept),'set have; where dept="',strip(dept),'"; run;'));
run;&lt;/PRE&gt;
&lt;P&gt;However, again I don't recommend splitting data up.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 14:28:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-dataset-from-source-dataset/m-p/455619#M115286</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-19T14:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple dataset from source dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-multiple-dataset-from-source-dataset/m-p/455623#M115288</link>
      <description>&lt;P&gt;1.&amp;nbsp;&lt;A href="http://www.sascommunity.org/wiki/Split_Data_into_Subsets" target="_blank" rel="nofollow noopener noreferrer"&gt;http://www.sascommunity.org/wiki/Split_Data_into_Subsets&lt;/A&gt;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;&lt;A href="https://blogs.sas.com/content/sasdummy/2015/01/26/how-to-split-one-data-set-into-many/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://blogs.sas.com/content/sasdummy/2015/01/26/how-to-split-one-data-set-into-many/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 14:41:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-multiple-dataset-from-source-dataset/m-p/455623#M115288</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-19T14:41:07Z</dc:date>
    </item>
  </channel>
</rss>

