data my;
input details $ 1-100;
cards;
I am John.
I studied from MM University
I have done MBA
;
run;
I need the ouput as below. but it is not reading the data properly.
details
------------
I am John.
I studied from MM University
I have done MBA
data my; infile cards truncover; input details $ 1-100; cards; I am John. I studied from MM University I have done MBA ; run;
Pay attention to what SAS tells you in the SAS log.
NOTE: SAS went to a new line when INPUT statement reached past the end of a line. NOTE: The data set WORK.MY has 1 observations and 1 variables.
Since in-line data is padded to the next multiple of 80 bytes trying to read 100 bytes from a line that only has 80 bytes is what is causing SAS to move to a new line to try and find enough data.
You can prevent that by adding an INFILE statement so you can add the TRUNCOVER option.
data my;
infile cards truncover;
input details $ 1-100;
cards;
I am John.
I studied from MM University
I have done MBA
;
Result
Obs details 1 I am John. 2 I studied from MM University 3 I have done MBA
Note that this is a good example of why you almost never want to use the ancient MISSOVER option.
Try it with MISSOVER instead of TRUNCOVER.
data my;
infile cards missover;
input details $ 1-100;
cards;
I am John.
I studied from MM University
I have done MBA
;
proc print;
run;
Obs details 1 2 3
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.