<?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 import multiple dbf-datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-dbf-datasets/m-p/874827#M345671</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;currently I have 4 datasets:&lt;/P&gt;
&lt;P&gt;gb2018.dbf&lt;/P&gt;
&lt;P&gt;gb2019.dbf&lt;/P&gt;
&lt;P&gt;gb2020.dbf&lt;/P&gt;
&lt;P&gt;gb2021.dbf&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The logic of their names is always the same: "&lt;EM&gt;gb&lt;/EM&gt;" and the year. Each year a new dataset will be added into the same path.&lt;/P&gt;
&lt;P&gt;Importing one of them works with following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile = '...PATH\gb2018.dbf'
out= Geb_2021
REPLACE
dbms = dbf;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But actually I want a code for importing a flexible selection of these datasets into one SAS-Dataset. For example: If I select the years 2018-2020, the code shall import gb2018.dbf, gb2018.dbf and gb2020.dbf. Do you have an idea, how to code that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would be nice to get some help! &lt;STRONG&gt;Thank you!&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 10 May 2023 05:38:43 GMT</pubDate>
    <dc:creator>Konkordanz</dc:creator>
    <dc:date>2023-05-10T05:38:43Z</dc:date>
    <item>
      <title>import multiple dbf-datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-dbf-datasets/m-p/874827#M345671</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;currently I have 4 datasets:&lt;/P&gt;
&lt;P&gt;gb2018.dbf&lt;/P&gt;
&lt;P&gt;gb2019.dbf&lt;/P&gt;
&lt;P&gt;gb2020.dbf&lt;/P&gt;
&lt;P&gt;gb2021.dbf&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The logic of their names is always the same: "&lt;EM&gt;gb&lt;/EM&gt;" and the year. Each year a new dataset will be added into the same path.&lt;/P&gt;
&lt;P&gt;Importing one of them works with following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile = '...PATH\gb2018.dbf'
out= Geb_2021
REPLACE
dbms = dbf;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But actually I want a code for importing a flexible selection of these datasets into one SAS-Dataset. For example: If I select the years 2018-2020, the code shall import gb2018.dbf, gb2018.dbf and gb2020.dbf. Do you have an idea, how to code that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would be nice to get some help! &lt;STRONG&gt;Thank you!&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 05:38:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-dbf-datasets/m-p/874827#M345671</guid>
      <dc:creator>Konkordanz</dc:creator>
      <dc:date>2023-05-10T05:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple dbf-datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-dbf-datasets/m-p/874837#M345673</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I would use a macro, for example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO importDBF(yearFrom=, yearTo=);
   %LOCAL year;
   %DO year=&amp;amp;yearFrom. %TO &amp;amp;yearTo.;
      PROC IMPORT DATAFILE = "...PATH\gb&amp;amp;year..dbf"
         OUT= Geb_&amp;amp;year.
         REPLACE
         DBMS = dbf;
      RUN;
   %END;
%MEND importDBF;
%importDBF(yearFrom=2018, yearTo=2020);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 May 2023 07:11:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-dbf-datasets/m-p/874837#M345673</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2023-05-10T07:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple dbf-datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-dbf-datasets/m-p/875399#M345876</link>
      <description>&lt;P&gt;Thank you, that works!&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 04:58:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-dbf-datasets/m-p/875399#M345876</guid>
      <dc:creator>Konkordanz</dc:creator>
      <dc:date>2023-05-12T04:58:57Z</dc:date>
    </item>
  </channel>
</rss>

