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

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

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

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".

 

Additional links:

Reading Past the End of a Line, MISSOVER, STOPOVER, and TRUNCOVER

View solution in original post

12 REPLIES 12
Ksharp
Super User

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

Patrick
Opal | Level 21

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".

 

Additional links:

Reading Past the End of a Line, MISSOVER, STOPOVER, and TRUNCOVER

Patrick
Opal | Level 21

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.

Tom
Super User Tom
Super User

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.


Tom
Super User Tom
Super User

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.

RahulVerma
Calcite | Level 5

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

arpi
Fluorite | Level 6

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!!!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 12 replies
  • 8008 views
  • 9 likes
  • 6 in conversation