<?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 access and manipulate the content of multiple dbf files? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-access-and-manipulate-the-content-of-multiple-dbf-files/m-p/105307#M21956</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The simplese way is use PIPE function to gain the power of OS command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;filename x pipe 'dir c:\test\*.txt /s /b'; * list all of txt files under c:\test;
data _null_;
 infile x length=len;
 input fname $varying200. len;
 call execute('proc import datafile="'||fname||'" out='||strip(scan(fname,-2,".\"))||' dbms=dlm replace;getnames=yes;delimiter=" ";run;');
 call execute('data '||strip(scan(fname,-2,".\"))||'; set '||strip(scan(fname,-2,".\"))||';code4=substr(code,length(code)-3);run;');
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 May 2012 07:41:57 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2012-05-07T07:41:57Z</dc:date>
    <item>
      <title>How to access and manipulate the content of multiple dbf files?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-access-and-manipulate-the-content-of-multiple-dbf-files/m-p/105306#M21955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Imagine that I have a lot of dbf files in different folders. For example, in d:\test\A, I have af.dbf, sh.dbf, and syhd.dbf. And in d:\test\B, I have ujs.dbf, i.dbf, qye.dbf, and ysuje.dbf. ... So, random large numbers of dbf files are distributed across some random numbers of folders under the d:\test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For all the dbf.files, there is a field (say, CODE). I want to add a field (say, CODE4), extract the last four digits of the values in CODE, and save them to the CODE4 as character values. So, it looks like as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CODE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CODE4&lt;/P&gt;&lt;P&gt;8273123878&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3878&lt;/P&gt;&lt;P&gt;9182787386&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7386&lt;/P&gt;&lt;P&gt;0182730099&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0099&lt;/P&gt;&lt;P&gt;61267198&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7198&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I automate that process for all the dbf files? Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 May 2012 01:45:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-access-and-manipulate-the-content-of-multiple-dbf-files/m-p/105306#M21955</guid>
      <dc:creator>tesu</dc:creator>
      <dc:date>2012-05-06T01:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to access and manipulate the content of multiple dbf files?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-access-and-manipulate-the-content-of-multiple-dbf-files/m-p/105307#M21956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The simplese way is use PIPE function to gain the power of OS command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;filename x pipe 'dir c:\test\*.txt /s /b'; * list all of txt files under c:\test;
data _null_;
 infile x length=len;
 input fname $varying200. len;
 call execute('proc import datafile="'||fname||'" out='||strip(scan(fname,-2,".\"))||' dbms=dlm replace;getnames=yes;delimiter=" ";run;');
 call execute('data '||strip(scan(fname,-2,".\"))||'; set '||strip(scan(fname,-2,".\"))||';code4=substr(code,length(code)-3);run;');
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 May 2012 07:41:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-access-and-manipulate-the-content-of-multiple-dbf-files/m-p/105307#M21956</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-05-07T07:41:57Z</dc:date>
    </item>
  </channel>
</rss>

