I did my work but could not confirm the answer.anyone's help is appreciated.
title 'v1 length 20 reading the same line' ;
data testing;
infile datalines ;
input v1 $ 20.;
datalines;
aa
bb xx
cc
dd zz
;
proc print;run;
title 'v1 length 100 reading the different line' ;
data testing;
infile datalines ;
input v1 $ 100.;
datalines;
aa
bb xx
ccd zz
;
run;
proc print;run;
/* v1 length 20 reading the same line 32
10:37 Monday, August 24, 2009
Obs v1
1 aa
2 bb xx
3 cc
4 dd zz
v1 length 100 reading the different line 33
10:37 Monday, August 24, 2009
Obs v1
1 bb xx
2 dd zz
*/
"v1 length 100 reading the different line" because typical record length is 80 columns. If you put $ 80 or less then you will be fine. Otherwise use truncover option in infile statement.
"v1 length 100 reading the different line" because typical record length is 80 columns. If you put $ 80 or less then you will be fine. Otherwise use truncover option in infile statement.
hi,
thanks for the reply.
I did noticed that anywhere (record length is 80).
I just remember this, if anything wrong ,please let me know.
if reading from external file default length=256 and
if reading from datalines default length=80
SAS always pads the data records that follow the DATALINES statement to a fixed length in multiples of 80. LRECL= option specifies the default logical record length to use for reading and writing external files. It has default value of 256.
use truncover option infile statement like this
title 'v1 length 20 reading the same line' ;
data testing;
infile datalines truncover;
input v1 $20.;
datalines;
aa
bb xx
cc
dd zz
;
proc print;
run;
title 'v1 length 100 reading the different line';
data testing;
infile datalines truncover;
input v1 $ 100.;
datalines;
aa
bb xx
ccd zz
;
run;
proc print;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.