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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.