Interview Questions   Tutorials   Discussions   Programs   Videos   

SAS - If reading a variable length file with fixed input, how would you prevent SAS from reading the next record if the last variable didn't have a value?




385
views
asked mar September 20, 2014 06:30 AM  

If reading a variable length file with fixed input, how would you prevent SAS from reading the next record if the last variable didn't have a value?


           

1 Answers



 
answered By vishnoiprem   0  

Options MISSOVER and TRUNCOVER options..

MISSOVER

prevents an INPUT statement from reading a new input data record if it does not find values in the current input line for all the variables in the statement. When an INPUT statement reaches the end of the current input data record, variables without any values assigned are set to missing.

TRUNCOVER

overrides the default behavior of the INPUT statement when an input data record is shorter than the INPUT statement expects. By default, the INPUT statement automatically reads the next input data record. TRUNCOVER enables you to read variable-length records when some records are shorter than the INPUT statement expects. Variables without any values assigned are set to missing.

For example, this DATA step program uses list input to read data that is separated with commas. The second data line contains a missing value. Because SAS allows consecutive delimiters with list input, the INPUT statement cannot detect the missing value.

data scores;
   infile datalines delimiter=',';
   input test1 test2 test3;
   datalines;
91,87,95
97,,92
,1,1

;

flag   
   add comment

Your answer

Join with account you already have

FF

Preview

 Write A Tutorials
Online-Classroom Classes
www.writeabc.com


  1 person following this question

  Question tags

sas × 1

Asked 2 years and 3 months ago ago
Number of Views -385
Number of Answers -1
Last updated
3 years and 2 months ago ago

  Similar questions


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert