DATA Step, Macro, Functions and more

Can Truncover ALWAYS be used in place of Missover and Pad?

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 119
Accepted Solution

Can Truncover ALWAYS be used in place of Missover and Pad?

Missover is used for List Inputs. Pad is used for Column and Formatted Inputs. Truncover replaces Pad for Column and Formatted inputs, Does it also replace Missover for List inputs? Is there ever a time when truncover is not a viable substitute for Pad or Missover? Are there ever times when Pad or Missover are more efficient/preferred vs truncover? Can I just use truncover from now on and pretty much forget about pad and missover, unless I come across it in code someone else has written?

 

Tx!


Accepted Solutions
Solution
‎03-16-2018 12:36 AM
Super User
Super User
Posts: 7,855

Re: Can Truncover ALWAYS be used in place of Missover and Pad?

[ Edited ]
Posted in reply to ManitobaMoose

Not sure where you are getting your statements of what the options are used for.

 

MISSOVER means the opposite of FLOWOVER which is the default.  So instead of hunting to the next line when it runs out of data it reads nothing.

 

PAD is what it sounds like.  Short lines are padded with spaces to the logical record length (LRECL).

 

TRUNCOVER is "new" (less than 30? years old) and eliminates one of quirkier "features" of MISSOVER that can happen when reading a fixed number of characters.   If you use MISSOVER and try to read past the end of the line then instead of using the characters that are there it reads nothing.  So if you are trying to read 10 characters into NAME and the only thing left at that position is 'FRED' then NAME will be missing instead of being set to 'FRED'.

 

Basically using TRUNCOVER eliminates the need for MISSOVER (with or without PAD).  Unless you really really really want SAS to throw away those short values you should always use TRUNCOVER and just forget that MISSOVER option even still exists.

 

If you do see MISSOVER in someone's code then triple check their INPUT statement and make sure it uses list mode only and not formatted/positional input.  That is if they have informat specifications in the INPUT statement then the informats MUST have the : (colon) modifier in front of them.  If they are reading from positions (input name $ 1-40; ) then make sure that it is ok that short values will become missing.

View solution in original post


All Replies
Solution
‎03-16-2018 12:36 AM
Super User
Super User
Posts: 7,855

Re: Can Truncover ALWAYS be used in place of Missover and Pad?

[ Edited ]
Posted in reply to ManitobaMoose

Not sure where you are getting your statements of what the options are used for.

 

MISSOVER means the opposite of FLOWOVER which is the default.  So instead of hunting to the next line when it runs out of data it reads nothing.

 

PAD is what it sounds like.  Short lines are padded with spaces to the logical record length (LRECL).

 

TRUNCOVER is "new" (less than 30? years old) and eliminates one of quirkier "features" of MISSOVER that can happen when reading a fixed number of characters.   If you use MISSOVER and try to read past the end of the line then instead of using the characters that are there it reads nothing.  So if you are trying to read 10 characters into NAME and the only thing left at that position is 'FRED' then NAME will be missing instead of being set to 'FRED'.

 

Basically using TRUNCOVER eliminates the need for MISSOVER (with or without PAD).  Unless you really really really want SAS to throw away those short values you should always use TRUNCOVER and just forget that MISSOVER option even still exists.

 

If you do see MISSOVER in someone's code then triple check their INPUT statement and make sure it uses list mode only and not formatted/positional input.  That is if they have informat specifications in the INPUT statement then the informats MUST have the : (colon) modifier in front of them.  If they are reading from positions (input name $ 1-40; ) then make sure that it is ok that short values will become missing.

Frequent Contributor
Posts: 119

Re: Can Truncover ALWAYS be used in place of Missover and Pad?

Excellent explanation.

Essentially, Truncover can replace Missover and Pad. Now I also understand more about where the term Missover comes from. Thanks!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 92 views
  • 2 likes
  • 2 in conversation