08-20-2016 04:31 AM
I have 2 lines of data below. The 1st three characters are for ID, however 2nd row is missing the ID.
How can I read this file properly with the INFILE statement? MISSOVER doesn't work in this case.
08-20-2016 06:32 AM
I am aware of column input, however M10 becomes the ID and the rest moves to the left.
ID in 2nd row is supposed to be blank.
The MISSOVER in infile does not help.
08-20-2016 08:49 AM
change your input line to:
input @1 ID $CHAR3.
@4 sex $1.
@5 others $char26.
the @ assigns from which postion to read
the informat $CHAR3. means to read 3 characters without any alignment of data
othrwise, the default of input statement is to align the data to left.
you may change read sex as 1. if you preffer it numeric, instead $1. or $char1. as a character.
08-20-2016 11:30 AM
Both of the suggestions you have received are viable approaches. If you get M10 as the value of ID, something is different than what you have presented. Maybe M10 is actually in columns 1 through 3. Maybe you tried a different INPUT statement. But the suggestions you have received work properly on the data you have shown.
08-22-2016 02:34 PM
you may check the contents of ID by PUT ID $HEX6. to the log.
Locate the statement at the end of INPUT statement.
In case of TAB you will see '09'x in the 1st character;
What do you get in the log ?