<?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: Count delimter (typically gives me header count) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360916#M85039</link>
    <description>&lt;P&gt;1. Get a list of files - see SAS 9.4 macro appendix on how that can be done automatically or search on here for many various solutions. Pretty sure I posted one last week.&lt;/P&gt;
&lt;P&gt;2. Use a datastep to read a single line from a single file and count the number of delimiters (infile, COUNTW). Make sure it works for one file CORRECTLY before moving forward.&lt;/P&gt;
&lt;P&gt;3. Look at FILEVAR option that allows you read multiple files based on paths, which you have from step 1&lt;/P&gt;
&lt;P&gt;4. Combine 3/4 so that it will process all your files&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 23 May 2017 20:22:31 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-05-23T20:22:31Z</dc:date>
    <item>
      <title>Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360906#M85033</link>
      <description>&lt;P&gt;There are 50k files. I would like to check the number of columns in each file . The raw files are text files. I would like to see the the file name, number of columns in a temp dataset &amp;nbsp;before actually reading them into SAS datasets. The delimiter is tab separated.&lt;/P&gt;&lt;P&gt;Any help is appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 20:05:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360906#M85033</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2017-05-23T20:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360907#M85034</link>
      <description>&lt;P&gt;Ok...so what's your question?&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 20:06:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360907#M85034</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-23T20:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360910#M85035</link>
      <description>&lt;P&gt;How to get the header count&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 20:12:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360910#M85035</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2017-05-23T20:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360911#M85036</link>
      <description>&lt;P&gt;So what will you actually do with the approximately 625 pages of results?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are all of the text files in the same folder? Mulitple folders? Is there any regular pattern to the names of the files?&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 20:15:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360911#M85036</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-23T20:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360912#M85037</link>
      <description>&lt;P&gt;1. Either process the first line of each file - read it in using filevar and obs=1 and then use COUNTW to count the number of the delimiter&lt;/P&gt;
&lt;P&gt;2. Use Powershell/Unix command lines to get this information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;#2 will be more efficient, faster and is most likely the right tool for the job.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS can do it, but it's a hammer vs thumbtack.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 20:16:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360912#M85037</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-23T20:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360914#M85038</link>
      <description>&lt;P&gt;Same folder.&lt;/P&gt;&lt;P&gt;abc.txt&lt;/P&gt;&lt;P&gt;pqr.txt&lt;/P&gt;&lt;P&gt;xyz.txt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File_name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; header_cnt&lt;/P&gt;&lt;P&gt;abc.txt&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; 25&lt;/P&gt;&lt;P&gt;pqr.txt&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; 26&lt;/P&gt;&lt;P&gt;xyz.txt&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; 30&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 20:21:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360914#M85038</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2017-05-23T20:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360916#M85039</link>
      <description>&lt;P&gt;1. Get a list of files - see SAS 9.4 macro appendix on how that can be done automatically or search on here for many various solutions. Pretty sure I posted one last week.&lt;/P&gt;
&lt;P&gt;2. Use a datastep to read a single line from a single file and count the number of delimiters (infile, COUNTW). Make sure it works for one file CORRECTLY before moving forward.&lt;/P&gt;
&lt;P&gt;3. Look at FILEVAR option that allows you read multiple files based on paths, which you have from step 1&lt;/P&gt;
&lt;P&gt;4. Combine 3/4 so that it will process all your files&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 20:22:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360916#M85039</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-05-23T20:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360926#M85043</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First create a data set that holds the list of files to check, there are different approches to that, like FILENAME statement with the PIPE access method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you have the list you can use a second DATA Step to read the first line of each file, Have a look at the FILEVAR= option of the INFILE statement. Using just and empty INPUT; statement read the first line. Then you can use the COUNTW function to count the number of "words" delimited by "09"x (hexadecimal for TAB char).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 20:43:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/360926#M85043</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2017-05-23T20:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361109#M85118</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16600"&gt;@SASPhile&lt;/a&gt;: I would try something like this:&lt;/P&gt;&lt;PRE&gt;%let dir=/usr/local/tmp; /* full path of directory with files */
data members;
  did=dopen('indir');
  do _n_=1 by 1;
    fname=dread(did,_N_);
    if fname=' ' then leave;&lt;BR /&gt;    /* you can also put criteria here, instead of in the next datastep, &lt;BR /&gt;       only LIKE is very nifty and only available with WHERE */
    output;
    end;
  keep fname;
run;

data hcount;
  set members;
  where upcase(fname) like '%.TXT'; /* or whatever criteria you want */
  path=cats("&amp;amp;dir",'/',fname); /* may have to change / to \ for Windows */
  infile dummy filevar=path;
  input;
  count=count(_infile_,'09'x);
  keep fname count;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 May 2017 09:11:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361109#M85118</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2017-05-24T09:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361123#M85124</link>
      <description>&lt;P&gt;If you can use PIPE from your SAS session (some server installations have this disabled) then use that to get the list of files and then use FILEVAR option to open each one. &amp;nbsp;Here is example using Linux syntax. For DOS/Windows systems change 'ls -d' to 'dir /b'.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=/myfolder;
data want ;
   length filename $100 header_cnt 8 filevar $255 ;
   infile "cd &amp;amp;path ; ls -d *.txt" pipe truncover ;
   input filename ;
   filevar=catx('/',"&amp;amp;path",filename);
   infile header filevar=filevar end=eof;
   if eof then header_cnt=0;
  else do;
    input ;
    header_cnt=countw(_infile_,'09'x,'mq');
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Otherwise you could use a wildcard in a regular INFILE statement with the FILENAME option, but then you will need to read all of the lines of all of the lines. Should work for either Linux or DOS/Windows systems.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=/myfolder;
data want ;
   length filename $100 header_cnt 8 filevar $255 ;
   infile "&amp;amp;path/*.txt" eov=eov filename=filevar truncover ;
   input ;
   if _n_=1 or eov then do;
     filename=scan(filevar,-1,'/\');
     header_cnt=countw(_infile_,'09'x,'mq');
     output;
  end;
  eov=0;
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 09:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361123#M85124</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-05-24T09:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361136#M85129</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;: I would probably use the COUNT function rather than the COUNTW function - when parsing .csv files, two consecutive delimiters means that there is a column, but it is empty in that row. Using COUNTW could give you the number of non-empty columns in the row being parsed, not the total number of columns in the file.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 10:57:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361136#M85129</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2017-05-24T10:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361208#M85150</link>
      <description>&lt;P&gt;The M and Q modifiers on the COUNTW() function handle the missing values. Note that the COUNT() function cannot handle&amp;nbsp;cases where the value can contain the delimiter.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 13:44:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361208#M85150</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-05-24T13:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361221#M85156</link>
      <description>&lt;P&gt;I believe in this statement did=dopen('indir'), it should be 'dir' in place of 'indir'?&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 14:13:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361221#M85156</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2017-05-24T14:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361228#M85159</link>
      <description>&lt;P&gt;this code if it is run once,it is working. if I had to run the second time by adding more files to the directory, I'm getting an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;" ERROR: File is in use,"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token macroname"&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color="#000080"&gt;%let&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; path&lt;FONT color="#a67f59"&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;/FONT&gt;myfolder&lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="token procnames"&gt;&lt;STRONG&gt;&lt;FONT color="#000080"&gt;data&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; want &lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token function"&gt;&lt;FONT color="#0000ff"&gt;length&lt;/FONT&gt;&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;&lt;FONT color="#0000ff"&gt;filename&lt;/FONT&gt;&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;$&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;&lt;STRONG&gt;&lt;FONT color="#008080"&gt;100&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; header_cnt &lt;SPAN class="token number"&gt;&lt;STRONG&gt;&lt;FONT color="#008080"&gt;8&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; filevar &lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;$&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;&lt;STRONG&gt;&lt;FONT color="#008080"&gt;255&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token statement"&gt;&lt;FONT color="#0000ff"&gt;infile&lt;/FONT&gt;&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;&lt;FONT color="#800000"&gt;"&amp;amp;path/*.txt"&lt;/FONT&gt;&lt;/SPAN&gt; eov&lt;SPAN class="token operator"&gt;&lt;FONT color="#a67f59"&gt;=&lt;/FONT&gt;&lt;/SPAN&gt;eov &lt;SPAN class="token statement"&gt;&lt;FONT color="#0000ff"&gt;filename&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&lt;FONT color="#a67f59"&gt;=&lt;/FONT&gt;&lt;/SPAN&gt;filevar truncover &lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token keyword"&gt;&lt;FONT color="#0000ff"&gt;input&lt;/FONT&gt;&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token keyword"&gt;&lt;FONT color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/SPAN&gt; _n_&lt;SPAN class="token operator"&gt;&lt;FONT color="#a67f59"&gt;=&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;&lt;STRONG&gt;&lt;FONT color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; or eov &lt;SPAN class="token keyword"&gt;&lt;FONT color="#0000ff"&gt;then&lt;/FONT&gt;&lt;/SPAN&gt; do&lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token statement"&gt;&lt;FONT color="#0000ff"&gt;filename&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&lt;FONT color="#a67f59"&gt;=&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;&lt;FONT color="#0000ff"&gt;scan&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;(&lt;/FONT&gt;&lt;/SPAN&gt;filevar&lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;,&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;&lt;STRONG&gt;&lt;FONT color="#008080"&gt;-1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;,&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;&lt;FONT color="#800000"&gt;'/\'&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color="#999999"&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; header_cnt&lt;SPAN class="token operator"&gt;&lt;FONT color="#a67f59"&gt;=&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;&lt;FONT color="#0000ff"&gt;countw&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;(&lt;/FONT&gt;&lt;/SPAN&gt;_infile_&lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;,&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;&lt;FONT color="#800000"&gt;'09'&lt;/FONT&gt;&lt;/SPAN&gt;x&lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;,&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;&lt;FONT color="#800000"&gt;'mq'&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color="#999999"&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output&lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; end&lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; eov&lt;SPAN class="token operator"&gt;&lt;FONT color="#a67f59"&gt;=&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;&lt;STRONG&gt;&lt;FONT color="#008080"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="token procnames"&gt;&lt;STRONG&gt;&lt;FONT color="#000080"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;&lt;FONT color="#999999"&gt;;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 14:39:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361228#M85159</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2017-05-24T14:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361243#M85162</link>
      <description>&lt;P&gt;If it worked once but now you are getting 'file in use' error messages then most likely the issue is that you have one or more of the individual files open with some other application.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 15:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361243#M85162</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-05-24T15:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: Count delimter (typically gives me header count)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361246#M85164</link>
      <description>&lt;P&gt;Sorry, forgot a line in the program, the filename statement:&lt;/P&gt;&lt;PRE&gt;%let dir=/usr/local/tmp; /* full path of directory with files */
Filename indir "&amp;amp;dir";
data members;
  did=dopen('indir');
  do _n_=1 by 1;
    fname=dread(did,_N_);
    if fname=' ' then leave;
    /* you can also put criteria here, instead of in the next datastep, 
       only LIKE is very nifty and only available with WHERE */
    output;
    end;
  keep fname;
run;

data hcount;
  set members;
  where upcase(fname) like '%.TXT'; /* or whatever criteria you want */
  path=cats("&amp;amp;dir",'/',fname); /* may have to change / to \ for Windows */
  infile dummy filevar=path;
  input;
  count=count(_infile_,'09'x);
  keep fname count;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 May 2017 15:25:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-delimter-typically-gives-me-header-count/m-p/361246#M85164</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2017-05-24T15:25:17Z</dc:date>
    </item>
  </channel>
</rss>

