BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
cottons23
Fluorite | Level 6

Hi all,

 

I have a situation where I need to create a dataset with some long free text. Is there a way to force SAS to read the below correctly beyond the 80th column? Works well if PARAMETER was limited to 80th column, beyond that it gets messed up. Also, MISSOVER option didn't solve the issue.  Output of below code shown below.

 

data test;
/* infile datalines missover;*/
input ord 1-2 _NAME_ $ 4-5 PARAMETER $ 7-185;
cards;
1  A  text here text here 
2  B  text here text here text here text here text here text here 
3  C  text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here
4  D  text here
;
 
cottons23_1-1713458740520.png

 

cottons23_0-1713458417569.png

Thanks!

1 ACCEPTED SOLUTION
5 REPLIES 5
cottons23
Fluorite | Level 6
Perfect, than you!
Ksharp
Super User

I got no problem with your code.

But you could also try this alternative code .



options parmcards=x;
filename x temp;
parmcards;
1  A  text here text here 
2  B  text here text here text here text here text here text here 
3  C  text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here xx
4  D  text here
;

data test;
infile x lrecl=32767 truncover;
input ord 1-2 _NAME_ $ 4-5 PARAMETER $ 7-200;
run;
cottons23
Fluorite | Level 6
Thanks this also fixes my problem
Tom
Super User Tom
Super User

That is because there are very few situations where you ever would want to use the ancient MISSOVER option.

 

Instead you should always use the modern (probably more than 30 years old) TRUNCOVER option when you don't want the default FLOWOVER option.

 

The reason you would use MISSOVER in this situation is when you want SAS to IGNORE anything in columns 7 to 185 that does not completely fill all 179 bytes with something.  And since in-line data is padded to use the next multiple of 80 bytes that means that to avoid losing data when using MISSOVER with your code each line would have to have at least 161 bytes.

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 323 views
  • 2 likes
  • 4 in conversation