Hi
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.
193F1010790815950407011206811
M1015950215960408009805410
Thank you
Using column input method: data have; input id $ 1-3 sex $ 4-4 others $ 5-30; cards; 193F1010790815950407011206811 M1015950215960408009805410 ; run;
Hi. Thanks.
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.
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.
Shmuel
If that was true , then the second row maybe don't have blanks before M10. You should check your data firstly and Post some real data here .
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.
Any chance that is a tab and not 3 spaces?
And what does your current infile and input statement look like?
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 ?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.