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!
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.