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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.