1.

State difference between Missover and Truncover in SAS.

Answer»
  • Missover: The INPUT STATEMENT does not jump to the next line when the Missover option is used on the INFILE statement. If the INPUT statement cannot read the entire field specified due to the field length, it will set the value to missing. The variables with no values assigned are set to missing when an INPUT statement reaches the end of an input data record.

Example: An external file with variable-length records, for example, contains the FOLLOWING records: 

1 22 333 4444 55555

Following are the steps to create a SAS data set using these data. The numeric informat 5 is used for this data step and the informatted length of the variable NUM is matched by only one input record. 

data readin; infile 'external-file' missover; input NUM 5.; run; PROC print data=readin; run;

Output: 

Obs ID 1 . 2 . 3 . 4 . 5 55555

Those values that were read from input records that were too short have been set to missing. This problem can be corrected by using the TRUNCOVER option in the INFILE statement:

  • Truncover: This option assigns the raw data value to the variable, even if it is shorter than what the INPUT statement expects. 

Example:  

An external file with variable-length records, for example, contains the following records: 

1 22 333 444455555

Following are the steps to create a SAS data set using these data. The numeric informat 5 is used for this data step.

data readin; infile 'external-file' truncover; input NUM 5.; run; proc print data=readin; run;

Output: 

Obs ID 1 1 2 22 3 333 4 4444 5 55555

Those values that were read from input records that were too short are not set to missing.



Discussion

No Comment Found