<?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: Infile with wildcard path vs Infile with filevar in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Infile-with-wildcard-path-vs-Infile-with-filevar/m-p/783053#M249638</link>
    <description>&lt;P&gt;You don't appear to ever read past the first line of the file because all of your INPUT statements have a trailing&amp;nbsp;@.&amp;nbsp; And since you are running them all in a single iteration SAS never moves to the next line.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do while (not done);
  row+1;
  input tag ?? @1 @;
  if missing(tag) then input extra @ ;
  do col=1 by 1 until(tag=' ');
    input tag text @;
    if tag ne ' ' then output;
  end;
  input;
end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 30 Nov 2021 01:46:16 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-11-30T01:46:16Z</dc:date>
    <item>
      <title>Infile with wildcard path vs Infile with filevar</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Infile-with-wildcard-path-vs-Infile-with-filevar/m-p/783046#M249633</link>
      <description>&lt;P&gt;Hello all, in a previous question I needed help with a wire format import see:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/fedwire-funds-format-files-with-tags-and-elements/td-p/762167" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/fedwire-funds-format-files-with-tags-and-elements/td-p/762167&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This has been working fantastically, however, as the number of files grow, I would like to use a dataset that list the files in a specific directory, compare that to my data already processed and only process new files. I've been able to do this for other imported text and csv files. With this particular layout of data, I'm only able to get the first record to import and it doesn't import the other two records. I tried adding a end=done, and do while (not done) but it runs indefinitely, tried putting the do while in different locations, but I'm at a lost.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro wires(path); 
	filename pipedir pipe " dir ""&amp;amp;path\"" " lrecl=5000;
	data FILES_LISTED;
		infile pipedir truncover;
		input line $char1000.;
		length DIRECTORY $1000;
		retain DIRECTORY;
		if line =' ' or	index(upcase(line),'&amp;lt;DIR&amp;gt;') or left(upcase(line)) = :'VOLUME' then delete;
		if left(upcase(line)) = :'DIRECTORY OF' then DIRECTORY = left(substr(line,index(upcase(line),'DIRECTORY OF')+12));
		if left(upcase(line)) = :'DIRECTORY OF' then delete;
		if input(substr(line,1,10),?? mmddyy10.) = . then delete;
		FILE_DATE = input(substr(line,1,20),?? anydtdtm32.);
		format FILE_DATE NLDATMAP20.;
		FILE_SIZE = INPUT(substr(line,21,19),comma20.); 
		FILE_NAME = STRIP(substr(line,40));
		FILES = CATX("\",DIRECTORY,FILE_NAME);
		drop line;
		if index(upcase(FILE_NAME),'.ACK') or index(upcase(FILE_NAME),'.DAT') or index(upcase(FILE_NAME),'.XLSX') 
			or index(upcase(FILE_NAME),'.XLS') or index(upcase(FILE_NAME),'.PDF') or index(upcase(FILE_NAME),'.LNK') 
			or index(upcase(FILE_NAME),'.ZIP') or index(upcase(FILE_NAME),'.RPT') or index(upcase(FILE_NAME),'.CSV')
			or index(upcase(FILE_NAME),'.PRC643') or index(upcase(FILE_NAME),'.TSV') then delete;
	run;
	PROC SQL;
		CREATE TABLE WORK.NEW_FILES AS SELECT 
			t1.DIRECTORY, 
			t1.FILE_DATE, 
			t1.FILE_SIZE, 
			t1.FILE_NAME, 
			t1.FILES
		FROM WORK.FILES_LISTED t1
		WHERE FILE_NAME LIKE "%.txt";
	QUIT;
	data dsn;
		length row col tag 8 extra $32 text $1000;
		set NEW_FILES;
		location=cats("&amp;amp;path\",FILE_NAME);
		infile dummy filevar=location DLM="{}" truncover &lt;FONT color="#0000FF"&gt;end=done&lt;/FONT&gt;;
		&lt;FONT color="#0000FF"&gt;do while (not done);&lt;/FONT&gt;
			row+1;
			input tag ?? @1 @;
			if missing(tag) then input extra @ ;
			do col=1 by 1 until(tag=' ');
				input tag text @;
				if tag ne ' ' then output;
			end;
		end;
	run;
%mend wires;
%wires(C:\Users\jwalker\Desktop\DataFileInputs\Sablewires\New Folder)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Nov 2021 23:12:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Infile-with-wildcard-path-vs-Infile-with-filevar/m-p/783046#M249633</guid>
      <dc:creator>jimbobob</dc:creator>
      <dc:date>2021-11-29T23:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: Infile with wildcard path vs Infile with filevar</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Infile-with-wildcard-path-vs-Infile-with-filevar/m-p/783053#M249638</link>
      <description>&lt;P&gt;You don't appear to ever read past the first line of the file because all of your INPUT statements have a trailing&amp;nbsp;@.&amp;nbsp; And since you are running them all in a single iteration SAS never moves to the next line.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do while (not done);
  row+1;
  input tag ?? @1 @;
  if missing(tag) then input extra @ ;
  do col=1 by 1 until(tag=' ');
    input tag text @;
    if tag ne ' ' then output;
  end;
  input;
end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Nov 2021 01:46:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Infile-with-wildcard-path-vs-Infile-with-filevar/m-p/783053#M249638</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-11-30T01:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Infile with wildcard path vs Infile with filevar</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Infile-with-wildcard-path-vs-Infile-with-filevar/m-p/783250#M249705</link>
      <description>&lt;P&gt;Thanks Tom, so putting a Input; appears to stop the current hold of the&amp;nbsp;@ and moves on to next record, if I'm understanding right. Appreciate it.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 19:13:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Infile-with-wildcard-path-vs-Infile-with-filevar/m-p/783250#M249705</guid>
      <dc:creator>jimbobob</dc:creator>
      <dc:date>2021-11-30T19:13:24Z</dc:date>
    </item>
  </channel>
</rss>

