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

when do you use dsd and when do you use missover, am confused about the two. Thank You

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

@swayto wrote:

when do you use dsd and when do you use missover, am confused about the two. Thank You


They are not really related at all.

The DSD option controls how SAS treats (or when used on FILE statement creates) multiple adjacent delimiters.

The MISSOVER option controls what happens when you try to read past the end of the current line of text.

 

When you read normal text lines with spaces between the words you want SAS to treat multiple spaces as a single delimiter.  That way you can make your text look aligned by adding extra spaces.

data want;
  input id $ age weight;
cards;
ABC    1   25
XYZD  23  170
;

When you have a delimited file (like a CSV file) then you want it to treat adjacent delimiters as meaning that a value has no value (is missing).

data want;
  infile cards dsd ;
  input id $ age weight;
cards;
ABC,1,25
XYZD,23,170
ZZZ,,201
;

The MISSOVER tells SAS that when you try to read past the end of the line just return a missing value.  The default behavior is the FLOWOVER option in which case SAS will move on to the next line to look for enough values to satisfy the input statement.  

 

I really consider the MISSOVER option as being deprecated by the introduction of the TRUNCOVER option (which was what 25-30 years ago?).  The problem with MISSOVER is that when you used formatted input and specify an informat width of N characters and the line only has M characters left if M is less than N the MISSOVER option sets the result to missing.  The TRUNCOVER option instead will have SAS read the existing characters.  So MISSOVER option might be acceptable if the last field on the line is a field that has to be exactly a fixed number of character long and you want SAS to automatically set the field missing if it is too short.

 

The only relationship between them is that when reading a delimited file you need to use LIST mode input (in addition to the DSD option on the INFILE statement) then SAS will automatically adjust the width of the informat being used to match the width of the actual text being read. So in that case if you use MISSOVER option with LIST mode input style no actual characters are ignored.   But I just always use TRUNCOVER anyway.  

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

MISSOVER is explained here:

https://documentation.sas.com/?docsetId=basess&docsetTarget=n1qwzamyuzfaaen1nu2t702adpi7.htm&docsetV...

 

DSD is explained here:

https://documentation.sas.com/?docsetId=lestmtsref&docsetTarget=n1rill4udj0tfun1fvce3j401plo.htm&doc...

 

These two are unrelated to one another. DSD treats two consecutive delimiters as if there was a missing value in there. MISSOVER tells SAS not to read the next line if the line of text has fewer than the expected number of characters.

--
Paige Miller
Tom
Super User Tom
Super User

@swayto wrote:

when do you use dsd and when do you use missover, am confused about the two. Thank You


They are not really related at all.

The DSD option controls how SAS treats (or when used on FILE statement creates) multiple adjacent delimiters.

The MISSOVER option controls what happens when you try to read past the end of the current line of text.

 

When you read normal text lines with spaces between the words you want SAS to treat multiple spaces as a single delimiter.  That way you can make your text look aligned by adding extra spaces.

data want;
  input id $ age weight;
cards;
ABC    1   25
XYZD  23  170
;

When you have a delimited file (like a CSV file) then you want it to treat adjacent delimiters as meaning that a value has no value (is missing).

data want;
  infile cards dsd ;
  input id $ age weight;
cards;
ABC,1,25
XYZD,23,170
ZZZ,,201
;

The MISSOVER tells SAS that when you try to read past the end of the line just return a missing value.  The default behavior is the FLOWOVER option in which case SAS will move on to the next line to look for enough values to satisfy the input statement.  

 

I really consider the MISSOVER option as being deprecated by the introduction of the TRUNCOVER option (which was what 25-30 years ago?).  The problem with MISSOVER is that when you used formatted input and specify an informat width of N characters and the line only has M characters left if M is less than N the MISSOVER option sets the result to missing.  The TRUNCOVER option instead will have SAS read the existing characters.  So MISSOVER option might be acceptable if the last field on the line is a field that has to be exactly a fixed number of character long and you want SAS to automatically set the field missing if it is too short.

 

The only relationship between them is that when reading a delimited file you need to use LIST mode input (in addition to the DSD option on the INFILE statement) then SAS will automatically adjust the width of the informat being used to match the width of the actual text being read. So in that case if you use MISSOVER option with LIST mode input style no actual characters are ignored.   But I just always use TRUNCOVER anyway.  

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
  • 2 replies
  • 19696 views
  • 6 likes
  • 3 in conversation