<?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: Using a do loop to combine multiple data sets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-a-do-loop-to-combine-multiple-data-sets/m-p/501246#M133624</link>
    <description>&lt;P&gt;There is no need for any DO loop to concatenate datasets. Just list them all on the SET statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data vacancy_data_combined;
  set vacancy_data_1 vacancy_data_2 vacancy_data_3 vacancy_data_4 ;  
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If they really do have a simple range of numeric suffixes then you can use a member name list.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data vacancy_data_combined;
  set vacancy_data_1 - vacancy_data_4 ;  
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or if all of them have the same prefix (and no other datasets use that prefix) you can use the colon wildcard to make the member name list.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data vacancy_data_combined;
  set vacancy_data_: ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 03 Oct 2018 18:47:00 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-10-03T18:47:00Z</dc:date>
    <item>
      <title>Using a do loop to combine multiple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-a-do-loop-to-combine-multiple-data-sets/m-p/501244#M133622</link>
      <description>&lt;P&gt;Community,&lt;/P&gt;&lt;P&gt;I have several datasets with quarterly survey data, each with the same set of variables. I want to create one dataset from these multiple datasets without having to copy and paste the same steps with slightly different dataset names. I am a bit new to SAS so this is beyond my skill level. Can I use a do loop to read data from multiple datasets if I just use the&amp;nbsp;index variable in the name of the dataset? Or is there a different and better way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the basic scenario. I have 4 datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;vacancy_data_1&lt;/P&gt;&lt;P&gt;vacancy_data_2&lt;/P&gt;&lt;P&gt;vacancy_data_3&lt;/P&gt;&lt;P&gt;vacancy_data_4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create&amp;nbsp;1 dataset that combines these 4 separate dataset in order to output a graph of, for&amp;nbsp;example,&amp;nbsp;a change in&amp;nbsp;a varaible over time, since&amp;nbsp;these are quarterly datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My best guess is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data vacancy_data_combined;&lt;/P&gt;&lt;P&gt;do i=1 to 4;&lt;/P&gt;&lt;P&gt;set vacancy_data_i;&amp;nbsp;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 18:41:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-a-do-loop-to-combine-multiple-data-sets/m-p/501244#M133622</guid>
      <dc:creator>benjamin_2018</dc:creator>
      <dc:date>2018-10-03T18:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using a do loop to combine multiple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-a-do-loop-to-combine-multiple-data-sets/m-p/501246#M133624</link>
      <description>&lt;P&gt;There is no need for any DO loop to concatenate datasets. Just list them all on the SET statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data vacancy_data_combined;
  set vacancy_data_1 vacancy_data_2 vacancy_data_3 vacancy_data_4 ;  
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If they really do have a simple range of numeric suffixes then you can use a member name list.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data vacancy_data_combined;
  set vacancy_data_1 - vacancy_data_4 ;  
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or if all of them have the same prefix (and no other datasets use that prefix) you can use the colon wildcard to make the member name list.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data vacancy_data_combined;
  set vacancy_data_: ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Oct 2018 18:47:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-a-do-loop-to-combine-multiple-data-sets/m-p/501246#M133624</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-10-03T18:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using a do loop to combine multiple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-a-do-loop-to-combine-multiple-data-sets/m-p/501266#M133636</link>
      <description>Thank you Tom!</description>
      <pubDate>Wed, 03 Oct 2018 19:33:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-a-do-loop-to-combine-multiple-data-sets/m-p/501266#M133636</guid>
      <dc:creator>benjamin_2018</dc:creator>
      <dc:date>2018-10-03T19:33:02Z</dc:date>
    </item>
  </channel>
</rss>

