<?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: Loop-load multiple flat files and validate each one in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/417384#M26875</link>
    <description>Fantastic, thank you. I had heard elsewhere that SAS would ignore CR / LF if it encountered it mid-column, which I wasn't sure about. COMMA29 does indeed work!&lt;BR /&gt;&lt;BR /&gt;So am I correct in assuming that lengths for Informats are always "count from leftmost position" in these situations?</description>
    <pubDate>Thu, 30 Nov 2017 12:15:37 GMT</pubDate>
    <dc:creator>Doc_</dc:creator>
    <dc:date>2017-11-30T12:15:37Z</dc:date>
    <item>
      <title>Loop-load multiple flat files and validate each one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/407235#M26141</link>
      <description>&lt;P&gt;Hi there&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to solve a problem which I can do easily in other languages but am stuck doing in SAS. Using Enterprise Guide 5.1 (64-bit) on a Windows server.&amp;nbsp;The basic setup is as follows;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get a manually generated output from a system which stores per-day files in a folder structure on a network drive, in a flat text file with structured widths. I need to infile each of these. There is an existing procedure to do this, which works fine, except for the fact it does not validate it is receiving a&amp;nbsp;non-corrupted file, and cheerfully uploads garbage into a SAS table. Obviously the&amp;nbsp;log file for dealing with 30 files in one read is so long it's barely worth reading.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And if an error isn't picked up then the source system doesn't keep data forever, so invalid files can't be re-created....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The basic file structure would be as follows, let's say each file is supposed to be 500 characters wide;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;FIELD FIELD&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;&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; FINAL&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp; C&amp;nbsp;&amp;nbsp;LONG FIELD D&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; FIELD&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;-----&amp;nbsp;----- ---&amp;nbsp;---------------------&amp;nbsp;&amp;nbsp; ..... =====&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp; ONE&amp;nbsp;&amp;nbsp; AND&amp;nbsp;&amp;nbsp;&amp;nbsp;2 MAKEFOURBUTNOTFIVE&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; 1&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp; ONE&amp;nbsp;&amp;nbsp; AND&amp;nbsp;&amp;nbsp;&amp;nbsp;3 MAKEFOURBUTNOTFIVE&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; 0&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;TWO&amp;nbsp;&amp;nbsp; AND&amp;nbsp;&amp;nbsp;&amp;nbsp;2 MAKEFOURBUTNOTFIVE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;TWO&amp;nbsp;&amp;nbsp; AND&amp;nbsp;&amp;nbsp;&amp;nbsp;2 MAKEFOURBUTNOTFIVE&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; 1&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;TWO&amp;nbsp;&amp;nbsp; AND&amp;nbsp;&amp;nbsp;&amp;nbsp;2 MAKEFOURB&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;TWO&amp;nbsp;&amp;nbsp; AND&amp;nbsp;&amp;nbsp;&amp;nbsp;2 MAKEFOURBUTNOTFIVE&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; 1&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New"&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; ==================&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New"&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;&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; 6&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So as you can see lines #3 and #5 are evidence of a corrupted/incorrectly generated&amp;nbsp;file.&lt;/P&gt;&lt;P&gt;#3 I want to gracefully deal with, #5 I want to quit out the whole process, and not process any of the other files at all. Red lights and sirens all round.&lt;/P&gt;&lt;P&gt;The final line is a summary of how many records were output by the source system. If SAS hasn't read in the same number of Obs as the file says it supplied, then again, red lights and sirens. I am assuming that if I want to do this then I need to be able to "see" two lines in an INPUT statement, and therefore the INFILE should have n=2 as an option... correct?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need to do is;&lt;/P&gt;&lt;P&gt;if&amp;nbsp;Length(CurrentLine) = 500 then&lt;/P&gt;&lt;P&gt;&amp;nbsp; Input as normal&lt;/P&gt;&lt;P&gt;elseif length(CurrentLine) = 494 then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pickup the LAST FIELD from the incorrect position but input the rest of the line as normal.&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; scream a warning in ten foot letters and stop everything&lt;/P&gt;&lt;P&gt;end&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If LONGFIELD = "==================" then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Check the number of read-in obs against the entry in the next line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if ReadInObs &amp;lt;&amp;gt; ChecksumObs then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; scream a warning in ten foot letters and stop everything&lt;/P&gt;&lt;P&gt;end&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On another note, I am attempting to write a loop to go through&amp;nbsp;the day/month files, rather than the very long piece of "name each day file, generate a per-day table, add the per-day table to the master&amp;nbsp;table" process. But it&amp;nbsp;doesn't seem to want to take a variable filename...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%Let MonthA = Oct17;
%put &amp;amp;MonthA;
%Let MonthB = 1017;
%put &amp;amp;MonthB;

Data myLib.MasterFile_Day;
do i = 1 to 31;
	fname = "/Test/&amp;amp;MonthA/FixedpartofFileName " || put( i, z2.) || "&amp;amp;MonthB..txt";
	tmpname = "MasterFile_" || put( i, z2.);
	put fname;
	put tmpname;
	infile fname Length=LineLen line=currLine col=currColumn linesize=500  n=2 recfm = v lrecl = 32000 firstobs = 8 truncover;
	%Filereadin /* Macro for doing the input statement */

end;
run;&lt;/PRE&gt;&lt;P&gt;Running this code gets me "ERROR: No logical assign for filename FNAME."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, can't upload samples as it's sensitive data.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 13:06:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/407235#M26141</guid>
      <dc:creator>Doc_</dc:creator>
      <dc:date>2017-10-25T13:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Loop-load multiple flat files and validate each one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/407254#M26143</link>
      <description>&lt;P&gt;SAS will set _error_ during data step execution if the input statement encounters an error.&lt;/P&gt;
&lt;P&gt;So you might do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let inerr=0;
data table;
infile in;
input



;
if _error_ then call symput('inerr','1');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;so can later check &amp;amp;inerr and take appropriate action.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you run a&lt;/P&gt;
&lt;PRE&gt;grep ERROR my.log&lt;/PRE&gt;
&lt;P&gt;(insert your logfile name)&lt;/P&gt;
&lt;P&gt;in your sasbatch script, and if grep succeeds, throw an error that the scheduler catches.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 13:25:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/407254#M26143</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-25T13:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: Loop-load multiple flat files and validate each one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/407360#M26146</link>
      <description>&lt;P&gt;On your first query, here's a program that handles some of your issues. I can't really tell what your requirements are for processing records over two lines, so I can't do anything about that for now. Note that the first two steps just create a flat file in the format you're working with, to give the third program something to work on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let FileDir =C:\SomDir;

data have;
	length longrec $1000;
	input;
	longrec = _infile_;
	cards;
ONEAND2MAKEFOURBUTNOTFIVE    1
ONEAND3MAKEFOURBUTNOTFIVE    0
TWOAND2MAKEFOURBUTNOTFIVE 1
TWOAND2MAKEFOURBUTNOTFIVE    1
TWOAND2MAKEFOURB
TWOAND2MAKEFOURBUTNOTFIVE    1
==================
6
run;

data _null_;
	file "&amp;amp;FileDir.\testfile.txt" lrecl=32767;
	set have;
	put longrec;
run;

data Check1(keep=InputRecord) ErrorMessages(keep=ErrorMessage);
	length InputRecord $32767 ErrorMessage $256;
	retain EndSwitch 0 InputRecordCount 0;
	infile "&amp;amp;FileDir.\testfile.txt" lrecl=32767;
	input;

	/* This test can be adjusted, based on how many equal signs you're expecting, where they are, if it's variable, etc. */
	if _infile_ = "==================" then EndSwitch = 1; /* This line is the equal sign line */
	else if EndSwitch = 1 then EndSwitch = 2; /* This line is the line after the equal sign line, namely the record count line */

	if EndSwitch = 0 
		then do;

		/* This is a normal line */
		InputRecordCount = InputRecordCount + 1;
		InputRecordLength = length(_infile_);

		/* Do the stuff needed to parse the record into fields here, maybe using the "scan" function */
		InputRecord = _infile_;
		output Check1;

		if InputRecordLength ^= 30
			then do;
			ErrorMessage = "Record number " || strip(put(_n_, best15.)) || " is the wrong length, " || strip(put(InputRecordLength, best15.));

			/* This is one way to handle errors, there are millions in SAS */
			output ErrorMessages;
		end;
	end;

	if EndSwitch = 2
		then do;

		/* This is the line containing the record count */
		RecordedCount = input(strip(_infile_), best15.);

		if InputRecordCount ^= RecordedCount
			then do;
			ErrorMessage = "Incorrect recorded record count " || strip(put(RecordedCount, best15.)) || " compared to measured record count " || strip(put(InputRecordCount, best15.));
			output ErrorMessages;
		end;
	end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Oct 2017 16:41:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/407360#M26146</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2017-10-25T16:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: Loop-load multiple flat files and validate each one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/407370#M26148</link>
      <description>Thanks, I'll start testing these and see how things go!&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Oct 2017 17:10:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/407370#M26148</guid>
      <dc:creator>Doc_</dc:creator>
      <dc:date>2017-10-25T17:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Loop-load multiple flat files and validate each one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/414290#M26655</link>
      <description>&lt;P&gt;So I am now getting to a point where the error isn't making any sense. Whether the InputRecordCount is different to, or the same as the RecordedCount, the same error generates. RecordedCount doesn't seem to get populated but I've no idea why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File with an incorrect RecordedCount:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0                      

33466                            33,000. 30
    ZONE  222222222222222222222223323330
    NUMR  0000000000000000000000033C000D
InputRecord=. ErrorMessage=Incorrect recorded record count . compared to measured record count 33464 EndSwitch=2
InputRecordCount=33464 EndLine=0 Sirens=1 InputRecordLength=30 RecordedCount=. _ERROR_=1 _INFILE_=33,000 _N_=33466
ERROR: Execution terminated by an ABORT statement at line 21 column 22.

33467     . 1
    ZONE  0
    NUMR  D
InputRecord=  ErrorMessage=  EndSwitch=2 InputRecordCount=33464 EndLine=0 Sirens=1 InputRecordLength=. RecordedCount=. _ERROR_=1
_INFILE_= _N_=33467&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File with a correct RecordedCount:&lt;/P&gt;&lt;PRE&gt;RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0                      

33506                            33,497. 30
    ZONE  222222222222222222222223323330
    NUMR  0000000000000000000000033C497D
InputRecord=. ErrorMessage=Incorrect recorded record count . compared to measured record count 33497 EndSwitch=2
InputRecordCount=33497 EndLine=0 Sirens=1 InputRecordLength=30 RecordedCount=. _ERROR_=1 _INFILE_=33,497 _N_=33499
ERROR: Execution terminated by an ABORT statement at line 21 column 22.

33507     . 1
    ZONE  0
    NUMR  D
InputRecord=  ErrorMessage=  EndSwitch=2 InputRecordCount=33497 EndLine=0 Sirens=1 InputRecordLength=. RecordedCount=. _ERROR_=1
_INFILE_= _N_=33500&lt;/PRE&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>Fri, 17 Nov 2017 09:02:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/414290#M26655</guid>
      <dc:creator>Doc_</dc:creator>
      <dc:date>2017-11-17T09:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: Loop-load multiple flat files and validate each one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/417360#M26873</link>
      <description>&lt;P&gt;Ok, so I have "solved" the RecordedCount not being loaded, but it throws up a new problem;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RecordedCount will only get filled if I match the length of the informat &lt;U&gt;&lt;STRONG&gt;exactly&lt;/STRONG&gt;&lt;/U&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the main "read-in" Input statement, something like&lt;/P&gt;&lt;PRE&gt;input @ 12   Thing 18.&lt;/PRE&gt;&lt;P&gt;will work fine, and if the number of characters that make up the numeric value at position 12 is, say, 6 in one line and 12 in the next, both are correctly read in as numbers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However no matter what method of assigning a format to this variable I use, unless I exactly match the informat length to the number of characters which make up the total, it loads blank.&lt;/P&gt;&lt;P&gt;so assuming the text in the file says&lt;/P&gt;&lt;PRE&gt;           ==================
                       10,000&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"input RecordedCount;" (which SAS help alleges will just assign numeric automatically if it sees a number) results in a blank&lt;/P&gt;&lt;P&gt;"input RecordedCount 30.;" - Blank&lt;/P&gt;&lt;P&gt;"input &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/105043"&gt;@23&lt;/a&gt; RecordedCount comma6.;" - Blank&lt;/P&gt;&lt;P&gt;"input(_infile_,COMMA30.);"&amp;nbsp; - Blank&lt;/P&gt;&lt;P&gt;"input(_infile_,COMMA6.)" - Blank&lt;/P&gt;&lt;P&gt;"input(strip(_infile_),COMMA6.)" - Correct!&lt;/P&gt;&lt;P&gt;"input(strip(_infile_),COMMA5.)" - I have a number, but it's truncated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obviously, RecordedCount might be 10,000 in one file, and 99,999,999,999 in another, and 1 in another.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I'm required to know how many characters are used by the informat, I can't just use Length(strip(_infile_)) to do that... can I?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2017 11:30:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/417360#M26873</guid>
      <dc:creator>Doc_</dc:creator>
      <dc:date>2017-11-30T11:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Loop-load multiple flat files and validate each one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/417378#M26874</link>
      <description>&lt;P&gt;Look closely at this part of your log:&lt;/P&gt;
&lt;PRE&gt;RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0                      

33466                            33,000. 30
    ZONE  222222222222222222222223323330
    NUMR  0000000000000000000000033C000D&lt;/PRE&gt;
&lt;P&gt;The character at position 30 is a '0d'x, or carriage return. Every attempt to read a number that somehow incorporates this character will fail and produce a missing value. Read that with comma29., and you 'll be alright.&lt;/P&gt;
&lt;P&gt;Alternatively, you should look at your whole file. If you have a '0d'x at every end of a line, then you should use text mode when copying your file from the DOS/Windows environment to UNIX. Your records will shrink by 1 character, and only contain readable characters.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2017 12:06:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/417378#M26874</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-11-30T12:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Loop-load multiple flat files and validate each one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/417384#M26875</link>
      <description>Fantastic, thank you. I had heard elsewhere that SAS would ignore CR / LF if it encountered it mid-column, which I wasn't sure about. COMMA29 does indeed work!&lt;BR /&gt;&lt;BR /&gt;So am I correct in assuming that lengths for Informats are always "count from leftmost position" in these situations?</description>
      <pubDate>Thu, 30 Nov 2017 12:15:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/417384#M26875</guid>
      <dc:creator>Doc_</dc:creator>
      <dc:date>2017-11-30T12:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: Loop-load multiple flat files and validate each one</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/417393#M26877</link>
      <description>&lt;P&gt;LF or CRLF will always pose a special problem. When reading from text, LF (on UNIX) or CRLF (on Windows) will automatically terminate the current line and therefore input statement, and never appear in the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you have a&lt;/P&gt;
&lt;PRE&gt;termstr=lf&lt;/PRE&gt;
&lt;P&gt;option in the infile statement? If you read a DOS-formatted file with that, the CR will end up in the data.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2017 13:09:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Loop-load-multiple-flat-files-and-validate-each-one/m-p/417393#M26877</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-11-30T13:09:26Z</dc:date>
    </item>
  </channel>
</rss>

