<?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: import multiple text file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295976#M61923</link>
    <description>&lt;P&gt;1) &amp;nbsp;&lt;/P&gt;&lt;P&gt;In your code you wrote:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; symput(&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'read'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;||left(count),file_name);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; symput(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'dset'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;||left(count),substr(file_name,&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;118&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;7&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;));&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;it means that your macro variables will be:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;amp;read1 , &amp;amp;read2 , ...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;amp;dset1 , &amp;amp;dset2 , ...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Yout wrote:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; &amp;nbsp;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;read;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; &amp;nbsp;%put &amp;amp;dset&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;but there are no macro variables &amp;amp;read &amp;amp;dset &amp;nbsp;&lt;U&gt;but&lt;/U&gt; &amp;amp;read&lt;STRONG&gt;1&lt;/STRONG&gt; &amp;amp;dset&lt;STRONG&gt;1&lt;/STRONG&gt; etc.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;2)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;there is no error in: &amp;nbsp;proc import datafile=&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"&amp;amp;&amp;amp;read&amp;amp;i"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I do see error in: &amp;nbsp; out=&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%scan&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(&lt;STRONG&gt;&amp;amp;dset,&amp;amp;i&lt;/STRONG&gt;) dbms=dlm replace;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I suppose you meant to write: &amp;nbsp;out=&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%scan&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(&lt;STRONG&gt;&amp;amp;&amp;amp;dset.&amp;amp;i&lt;/STRONG&gt;) dbms=dlm replace;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/FONT&gt;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Sep 2016 19:17:34 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2016-09-01T19:17:34Z</dc:date>
    <item>
      <title>import multiple text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295971#M61919</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to import many text files into sas, i found a sas code at support SAS: &lt;A href="http://support.sas.com/kb/41/880.html" target="_blank"&gt;http://support.sas.com/kb/41/880.html&lt;/A&gt;&amp;nbsp; and modified&amp;nbsp;it. But&amp;nbsp;i still have some problems getting my desired result.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(I changed the dirctory&amp;nbsp;in the code into my dir)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;filename&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; DIRLIST &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;pipe&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#800080"&gt;'dir "C:\Users\*.txt" '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; dirlist ; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;infile&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; dirlist &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;lrecl&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;200&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;truncover&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;input&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; line &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;$200.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; input(substr(line,&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;10&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;), ?? &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;mmddyy10.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;) = &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;delete&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;length&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; file_name $ &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;100&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;file_name=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"c:\Users\"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;||scan(line,-&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;" "&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;keep&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; file_name; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;_null_&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; dirlist &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;end&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;=end; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;count+&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; symput(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'read'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;||left(count),file_name); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; symput(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'dset'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;||left(count),substr(file_name,&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;118&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;7&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;));&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; end &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; symput(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'max'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;,count); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;read;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;log: WARNING: &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#ff0000"&gt;&lt;FONT face="Courier New" size="2" color="#ff0000"&gt;&lt;FONT face="Courier New" size="2" color="#ff0000"&gt;Apparent&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; symbolic reference READ not &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;resolved.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;dset;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;log: WARNING: &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#ff0000"&gt;&lt;FONT face="Courier New" size="2" color="#ff0000"&gt;&lt;FONT face="Courier New" size="2" color="#ff0000"&gt;Apparent&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; symbolic reference DSET not &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;resolved.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;max; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;I got the correct dirlist data file, but the two macro variables are always empty.&lt;/FONT&gt;&lt;/FONT&gt;&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;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;2. I manully typed in the drictory of last data file and its data name into macro variables read and dset and tested for the following macro:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;&lt;I&gt;readin&lt;/I&gt;&lt;/STRONG&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%local&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; i; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%do&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; i=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%to&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; 1; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;proc import datafile=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"&amp;amp;&amp;amp;read&amp;amp;i"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;out=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%scan&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(&amp;amp;dset,&amp;amp;i) dbms=dlm replace;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;delimiter=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'|'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;getnames=yes;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%end&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; readin; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;readin&lt;/I&gt;&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think there is something wrong with the satement: &lt;FONT face="Courier New" size="2"&gt;datafile=&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"&amp;amp;&amp;amp;read&amp;amp;i"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; , cause, SAS read the first data file in that folder, while i assigned info of&amp;nbsp; the last dat file to the macro variabels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best wishes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 19:09:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295971#M61919</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-09-01T19:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295972#M61920</link>
      <description>&lt;P&gt;If your datasets have the same format you can use the method outline here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-do-I-write-a-macro-to-import-multiple-text-files-that-have/ta-p/223627" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-do-I-write-a-macro-to-import-multiple-text-files-that-have/ta-p/223627&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 19:10:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295972#M61920</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-01T19:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295976#M61923</link>
      <description>&lt;P&gt;1) &amp;nbsp;&lt;/P&gt;&lt;P&gt;In your code you wrote:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; symput(&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'read'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;||left(count),file_name);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; symput(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'dset'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;||left(count),substr(file_name,&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;118&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;7&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;));&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;it means that your macro variables will be:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;amp;read1 , &amp;amp;read2 , ...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;amp;dset1 , &amp;amp;dset2 , ...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Yout wrote:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; &amp;nbsp;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; &amp;amp;read;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; &amp;nbsp;%put &amp;amp;dset&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;but there are no macro variables &amp;amp;read &amp;amp;dset &amp;nbsp;&lt;U&gt;but&lt;/U&gt; &amp;amp;read&lt;STRONG&gt;1&lt;/STRONG&gt; &amp;amp;dset&lt;STRONG&gt;1&lt;/STRONG&gt; etc.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;2)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;there is no error in: &amp;nbsp;proc import datafile=&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"&amp;amp;&amp;amp;read&amp;amp;i"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I do see error in: &amp;nbsp; out=&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%scan&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(&lt;STRONG&gt;&amp;amp;dset,&amp;amp;i&lt;/STRONG&gt;) dbms=dlm replace;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I suppose you meant to write: &amp;nbsp;out=&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;%scan&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;(&lt;STRONG&gt;&amp;amp;&amp;amp;dset.&amp;amp;i&lt;/STRONG&gt;) dbms=dlm replace;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/FONT&gt;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 19:17:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295976#M61923</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-09-01T19:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295980#M61925</link>
      <description>&lt;P&gt;The initial part of the code creates multiple macro variables: read1,read2.. and dset1,dset2.... and max.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for the %put statement, you should rather list all read&amp;lt;n&amp;gt; and dset&amp;lt;n&amp;gt; macro variables:&lt;/P&gt;&lt;PRE&gt;%put &amp;amp;read1;
%put &amp;amp;dset1;
%put &amp;amp;max;&lt;/PRE&gt;&lt;P&gt;Or you can use this to list all user defined macro variables:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%put _user_;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the macro readin, it is meant to read multiple files. But it seems like you have limited it to read only one file, so it is reading only one file. You can change the macro readin as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%do i=1 to &amp;amp;max.;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;instead of&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%do i=1 to 1;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This should make the code read all the .txt files in the folder.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 19:26:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295980#M61925</guid>
      <dc:creator>set_all__</dc:creator>
      <dc:date>2016-09-01T19:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295986#M61928</link>
      <description>&lt;P&gt;You should include a large&amp;nbsp;GUESSINGROWS if you must use proc import. If a column has mixed values that might be considered numeric such as Zip code or account numbers that may contain other characters such as dashes or letters then the type of value, character or numeric may be guessed at incorrectly. This may become much more of a problem if you expect Zip to be character but is numeric in some and character in others.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Additionally if any of the files are supposed to be of the same layout and content you may end up with different lengths for character varaibles and the potential mismatches of variable types means that when you go to combine any of them for other purposes you will get errors or possibly truncated data.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 19:44:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295986#M61928</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-01T19:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295988#M61929</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro readin;
%local i;
%do i=1 %to &amp;amp;max;
 
proc import datafile="&amp;amp;&amp;amp;read&amp;amp;i"
out=&amp;amp;&amp;amp;dset&amp;amp;i dbms=dlm replace;
delimiter='|';
getnames=yes;
guessingrows=20000;
run;
 
%end;
%mend readin;
 
%readin;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In general it's better to write your own data step to read the data.&amp;nbsp;Issues with methodology include:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Will you continue to require macro processing to process each file? Or do you plan to combine this in the future?&lt;/P&gt;
&lt;P&gt;Will you ever need to know the source file for the records after combining, that isn't being stored anywhere right now.&lt;/P&gt;
&lt;P&gt;If you use proc import you can get different types for variables (numeric vs character) which means you can't append data until its fixed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If someone else with a different version of SAS runs this, they may not get the same results as Proc Import changes a bit over time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My nickel of opinion.&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>Thu, 01 Sep 2016 19:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295988#M61929</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-01T19:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295990#M61930</link>
      <description>Dear Rezza,&lt;BR /&gt;&lt;BR /&gt;Thank you for remind me the potential problems! YEs you are right. But the data I imported here are from one huge file, just stored in sub files, so I don't think I will have problems analyzing them in future.&lt;BR /&gt;&lt;BR /&gt;Thanks again!&lt;BR /&gt;&lt;BR /&gt;Best wishes.</description>
      <pubDate>Thu, 01 Sep 2016 20:02:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295990#M61930</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-09-01T20:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295991#M61931</link>
      <description>Dear set_all_,&lt;BR /&gt;&lt;BR /&gt;Thanks for your quick response! It helps me understand the macros I created.&lt;BR /&gt;&lt;BR /&gt;Best wishes.</description>
      <pubDate>Thu, 01 Sep 2016 20:03:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295991#M61931</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-09-01T20:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295992#M61932</link>
      <description>Dear Shmuel,&lt;BR /&gt;&lt;BR /&gt;Thank you! That answers my question.&lt;BR /&gt;&lt;BR /&gt;Best wishes.&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Sep 2016 20:03:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295992#M61932</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-09-01T20:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295994#M61933</link>
      <description>you are right, it should be out=&amp;amp;&amp;amp;dset&amp;amp;i</description>
      <pubDate>Thu, 01 Sep 2016 20:04:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295994#M61933</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-09-01T20:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295998#M61934</link>
      <description>&lt;P&gt;Since you apparently stuck all of this output in your WORK directory I provide any quick code but you really should examine at least a subset of the created data sets for mismatched lengths and variable types.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you had put them all in one location it would be easy to check using SASHelp.vcolumns and limited a summary to that library. Since there are very likely other sets in WORK it wouldn't be easy to exclude them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll put a small stack of quarters up that at least one variable has different lengths in different data sets.&lt;/P&gt;
&lt;P&gt;I would not be surprised to find a different variable name in one and finding several with different types would not surprise me.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 20:32:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/295998#M61934</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-01T20:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/296013#M61940</link>
      <description>Dear ballardw,&lt;BR /&gt;Thank you very much for the dead up!! I modified my code according to you suggestion.&lt;BR /&gt;&lt;BR /&gt;Best wishes.&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Sep 2016 23:02:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-file/m-p/296013#M61940</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-09-01T23:02:45Z</dc:date>
    </item>
  </channel>
</rss>

