I know for the fact I have 1000 obs
when I run my code which is the following in the output I see some of rows are missing and I only have up 821 rows.
libname blood "~/";
data blood.one;
Infile "~/blood.txt";
input
@1 obs 4.
@6 Gender $7.
@12 BloodType $3.
@15 AgeGroup $7.
@22 WBC 4.
@26 RBC 7.
@33Chol 4.
;
run;
What do the NOTEs in the SAS log say?
If you are going to use fixed format input statements like that then you must use the TRUNCOVER option on the INFILE statement.
infile "~/blood.txt" truncover;
With the default FLOWOVER option when you read past the end of the line the INPUT statement will hunt for the field on the next line. With the older less useful MISSOVER option if there are between 33 and 36 characters on the line then CHOL will be missing because there are not four characters for the 4. informat to read.
This is my raw data, the last column is Chol length is 3 but when I change it to 2 I see 1000 values.
I tried truncovern as well. Nothing changed. can you please help?
READ THE NOTES IN THE SAS LOG.
If you want help interpreting them then copy the lines from the SAS log for the data step that is reading the text file. Start with the DATA statement and include all of the notes after the end of the stop.
Paste them into the box that opens when you click on the Insert Code icon (the icon that looks like the characters < / > ). Please do not post text as photographs.
Perhaps SAS is trying to read the end of line characters as part of the data of the line.
Try adding the option TERMSTR=CRLF to the INFILE statement.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.