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
6 REPLIES 6
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.

cottons23
Fluorite | Level 6

Many thanks for that explanation! 🙂

sas-innovate-white.png

Our biggest data and AI event of the year.

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.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1410 views
  • 3 likes
  • 4 in conversation