SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

What exactly is the difference between missover and truncover?

Reply
Frequent Contributor
Posts: 89

What exactly is the difference between missover and truncover?

what exactly is the difference between missover and truncover?

As per as my knowledge missover is used if the last variable values are missing and we want SAS to assign missing value.

Truncover is used if some of the values of the input statement is less

Correct me ,with exact difference?

And also which is best

proc import over infille to bring the external file ?

Regards,

Naveen

Super User
Posts: 9,681

Re: What exactly is the difference between missover and truncover?

missover is washed-up. As far as I know truncover is the same with missover + pad ,truncover is new feature for the purpose of replacing missover .

Here is an example .

create a txt file contains the following .

Hariv

Amita      Bachchan

Abhishek

Aradhaya   Bachchan

NOTICE: after Hariv or Abhishek , there is not blanks only a  carriage character.

and run the following code , you will get wrong result.

data Forms;

infile 'c:\temp\x.txt' missover ;

input  Parent  $ 1-10 Child  $ 11-40 ;

run;

but if you add PAD in it , the result is right .

data Forms;

infile 'c:\temp\x.txt' missover pad;

input  Parent  $ 1-10 Child  $ 11-40 ;

run;

or you can change it into truncover , it is also and always right . Therefore truncover is better than missover.

data Forms;

infile 'c:\temp\x.txt' truncover;

input  Parent  $ 1-10 Child  $ 11-40 ;

run;

Xia Keshan

Frequent Contributor
Posts: 89

Re: What exactly is the difference between missover and truncover?

thanks a ton.

Frequent Contributor
Posts: 89

Re: What exactly is the difference between missover and truncover?

Thanks

Respected Advisor
Posts: 3,893

Re: What exactly is the difference between missover and truncover?

Here a useful link Step-by-Step Programming with Base SAS(R) Software which is something posted in 2011 and which I found searching this forum with terms "difference between missover and truncover".

Frequent Contributor
Posts: 89

Re: What exactly is the difference between missover and truncover?

Thanks a ton.

Respected Advisor
Posts: 3,893

Re: What exactly is the difference between missover and truncover?

You can say best "thank you" by marking answers as helpful and correct https://communities.sas.com/message/242631#242631

This also helps all of us to find "correct" answers to questions asked in the past - and it tells us which questions have already been answered so they don't show up in the "unanswered list" anymore.

Super User
Super User
Posts: 6,500

Re: What exactly is the difference between missover and truncover?

proc import over infille to bring the external file ?


Use PROC IMPORT when the file's format is unknown to you or you just want to get a quick conversion without a lot of coding.

If the format is well defined then you will have much more control and get better results by writing your own program.  You can also just run the PROC IMPORT interactively and recall the code that it generates as a starting point for writing your own data step.


Frequent Contributor
Posts: 89

Re: What exactly is the difference between missover and truncover?

Thanks a lot.

Super User
Super User
Posts: 6,500

Re: What exactly is the difference between missover and truncover?

MISSOVER is an old option and for most situations you should use TRUNCOVER instead.

Only place where it might be useful is when you have a field where a truncated value would be invalid, such as a phone number of an zip code.

But even then I would rather read the value from the line and then add code to handle truncated values.

Frequent Contributor
Posts: 89

Re: What exactly is the difference between missover and truncover?

thanks a ton.

New Contributor
Posts: 4

Re: What exactly is the difference between missover and truncover?

Hi,

As per my knowledge Missover Sets all empty vars to missing when reading a short line. However, it can also skip values.

Where as Truncover Forces the INPUT statement to stop reading when it gets to the end of a short line. This option will not skip information.

As Truncover does not skip the values so you must go for Truncover.

Thanks,

Rahul

New Contributor
Posts: 4

Re: What exactly is the difference between missover and truncover?

Consider  a txt file:

1 2 3
4 5
6 7 8
9 10 11

 

data missing1;
infile "C:\Users\sachin\Desktop\SAS\DataSet\Learning\missing.txt" pad;
input x y z;
run;

after execution  you will get 3 records and 3 observations.

after that update and change it ot truncover instead of pad

 

data missing1;
infile "C:\Users\sachin\Desktop\SAS\DataSet\Learning\missing.txt" truncover;
input x y z;
run;

this will run absolutely fine.

 

But if you  write missover instead of truncover that also works over here but not always.

 

Consider one more file:

001Josuha Tyson 88
002Helen Ames 75
003ShouEn Lu
004Pam Mann

 

data short;
infile "C:\Users\sachin\Desktop\SAS\DataSet\Learning\short.txt" pad;
input Subject $ 1-3
Name $ 4-15
Quiz 17-20
;
run;

run with pad, truncover and missover. Will work with pad and trunover but not with missover

 

My concern is to show truncover can be used in any situation for missing values. It has effect of the PAD and missover options combined and is a good overall choice for the INFILE option when you are reading "variable length" record.

 

I hope this helps!!!

Ask a Question
Discussion stats
  • 12 replies
  • 1752 views
  • 6 likes
  • 6 in conversation