attached is the dataset,
DATA data; INFILE "......\data.txt"; INPUT A 11. B ; RUN;
but the result is weird. some values are right, but some of them are false.
The log shows:
14 CHAR 10.20.00000001 14
ZONE 33033233333333
NUMR 10920E00000001
A=. B=1 _ERROR_=1 _N_=13
NOTE: 16 records were read from the infile "\\client\E$\course
materials\continue\Homeworks\HW2\data.txt".
The minimum record length was 4.
The maximum record length was 24.
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.DATA has 14 observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 0.26 seconds
cpu time 0.03 seconds
What is the matter of my code? and What does the former lines(in red) mean in the log?
The values in your file are separated by tab characters and start on line 2. So you must read them with:
data data;
infile "......\Data.txt" dlm='09'x firstobs=2;
input a b;
run;
The values in your file are separated by tab characters and start on line 2. So you must read them with:
data data;
infile "......\Data.txt" dlm='09'x firstobs=2;
input a b;
run;
'09'x is the hexadecimal representation of a tabulation character.
Thanks MR. PGstats, it works!!
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.