dharma
dharma

Reputation: 31

Validating SAS dataset

I want to validate a dataset which has 100 variables and over 100000 records. I am importing data in string form (even for the numeric data). I observed some variables getting truncated in the end. How do I validate each variable to make sure that the data populated totally (not truncated)?

Sample data:

data dsn;
infile "xyz.txt" dlm= '|' RECFM=V LRECL=2000 PAD MISSOVER;
length
a1 $20.
a2 $100.
a3 $50.
;
input a1 $
a2 $
a3 $
;
run;

For example the string value is 1532564.7564 and I am getting 1532564.756 after my import. So, My question is this is the value that got is getting truncated. But, when I change it to numerical data then I would get the full value. Like wise, Licnum is character data (eg:12xd456) and this is getting truncated in the last digit ( shows up as12xd4).

Upvotes: 0

Views: 293

Answers (1)

Richard
Richard

Reputation: 27508

Try these adjustments

  • Increase the LRECL
    Anything beyond 2000th character column would be getting clipped.
  • Increase the $ length of the variable getting clipped.
    The value 1532564.7564 is 12 characters and won't fit in a variable that is $11.
  • Make sure any variables with a $<n>. format are not longer than <n>
    If you have attrib Licnum length=$7 format=$5. then only the first five characters will be seen when the data is viewed.

Upvotes: 3

Related Questions