Hi All,
Sometimes if the last variable is of shorther length than sepcified in length statement SAS doesnt read the value. For example, I have the datafile as:
Sid,Cricket,Basketball,LawnTennis
Tim,Basketball,Golf,Tennis
Phil,Football
If I use the code:
data test1;
length t x y z $10.;
infile 'C:\Documents and Settings\Datafile1.txt' dsd ;
input t x y z $10.;
proc print data = test1;
run;
The cursor whenever reads the last value less than length 10 moves to next line and incorrectly read the values. The output is:
Obs t x y z
1 Sid Cricket Basketball LawnTennis
2 Tim Basketball Golf Phil,Footb
Please sugest.
Regards
SK
Try the TRUNCOVER option on your input statement and read up on it ![]()
Try the TRUNCOVER option on your input statement and read up on it ![]()
TRUNCOVER is not correct for LIST input.
Reeza wrote:
Try the TRUNCOVER option on your input statement and read up on it
The problem is
input t x y z $10.;
$10. turns your LIST(DSD) input into FORMATTED which is incompatable with DSD.
Get rid of $10. since you don't actually need it because you used LENGTH statement to define it or add : modifier :$10. to use informat with list input.
TRUNCOVER is not the correct solution to your problem!
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!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.