BookmarkSubscribeRSS Feed
GN0001
Barite | Level 11

Hello team,

 

Can you please help me in a simple language to explain what miss over and DSD is? I have been reading documents and I can't understand it.

 

Regards,

 

blueblue

Blue Blue
3 REPLIES 3
Tom
Super User Tom
Super User

You are talking about options of the INFILE statement.  They control how SAS moves the pointer on the line when the INPUT statement executes.

 

The DSD option means that you want SAS to treat the line as having delimited data.  It will treat two adjacent delimiters as meaning there is an empty value.  It will change the delimiter from the normal space to a comma (unless overridden by also using the DLM=, aka DELIMITER=, option).  It will also remove quotes from around values.  That is to allow you add quotes around values that contain the delimiter character itself.

 

Without DSD  (normal mode) the number of delimiters (spaces) between the values do not matter.  They are just there to make the text line up across lines either for use with FORMATTED input or just to make it easier for humans to look at the data.

data have; 
  input ID $ x1-x3;
datalines;
A 1  5  5
A 2  .  5
B 1  2  2
B 2  .  6
B 3 12 18
C 1  .  .
C 2  .  .
D 1  .  .
D 2  .  2
; 

With DSD you need a delimiter between each value on the line.  So if there are 4 values on the line you should have 3 delimiters

data have; 
  infile datalines dsd ;
  input ID $ x1-x3;
datalines;
A,1,5,5
A,2,,5
B,1,2,2
B,2,,6
B,3,12,18
C,1,,
C,2,,
D,1,,
D,2,,2
;

 

The MISSOVER option controls what happens when attempt to read past the end of the data on the line.  The default behavior is the FLOWOVER option which means that you should just move to the next line and continue looking there.  So if you have a lot of text to enter per observation you don't have to squeeze all onto one line.  With MISSOVER option the pointer stays on this line and just returns missing values when it runs out of values on the line.

 

In general you should never use the MISSOVER option.  Instead you should use the newer TRUNCOVER option.  The difference is what happens when there are some characters still available on the line, but they are shorter then the width of the informat specified in the INPUT statement. With MISSOVER that short value is discarded.  With TRUNCOVER the short value is used.

 

You should also read about the difference between LIST MODE input and FORMATTED input.  Both the DSD and MISSOVER option should be used with LIST MODE input.  With FORMATTED input you might read past the delimiter or not read all of the characters in the current delimited part of the line.  And it is when using FORMATTED input that the difference between MISSOVER and TRUNCOVER will apply.  Because when reading with LIST MODE the width of the value on the line overrides the width used on any informat your might be used so the condition that causes MISSOVER to miss data cannot happen.

GN0001
Barite | Level 11

Hello Tom,

Thanks for explanation. It is hard for me to understand. I will go back to this after while and I will read it again.

Thanks,

blueblue

Blue Blue
Kurt_Bremser
Super User

To see what MISSOVER does opposed to truncover, see this:

data _null_;
file '$HOME/check.txt';
put 'ABC1234';
put 'DEF123';
run;

data check1;
infile '$HOME/check.txt' missover;
input char $3. num 4.;
run;

data check2;
infile '$HOME/check.txt' truncover;
input char $3. num 4.;
run;

To see the effects of the DSD option, see this:

data _null_;
file '$HOME/check.txt';
put 'ABC,,123';
put '"D,F",123,456';
run;

data check1;
infile '$HOME/check.txt' dlm="," truncover;
input char $ num num2;
run;

data check2;
infile '$HOME/check.txt' dlm="," truncover dsd;
input char $ num num2;
run;

DSD is short for Delimiter Sensitive Data; it allows the use of successive delimiters to represent a missing value, and it allows the presence of delimiter characters within data values if those values are enclosed in quotes.

SAS Innovate 2025: Call for Content

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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