Fortunato
Fortunato

Reputation: 567

SAS - Recognize missing values when reading CSV

Given the csv:

Cat,,9
Dog,,10
Egg,,11

And the code:

DATA database ;
INFILE '/path/to/data' dlm=',' missover;
INPUT 
    animal $
    missing $ 
    number 
    ;
RUN;

The output I get is:

animal   missing   number
Cat      9        
Dog      10       
Egg      11

How can I get SAS to recognize the missing value, so that my output table is like the one below?

animal   missing   number
Cat                9        
Dog                10       
Egg                11

Upvotes: 3

Views: 997

Answers (1)

Bendy
Bendy

Reputation: 3576

You just need to include dsd in your infile statement as this signifies that SAS should treat two consecutive commas as a missing value. You can read more information here:

DATA database ;
INFILE '/path/to/data' dlm=',' missover dsd;
INPUT 
    animal $
    missing $ 
    number 
    ;
RUN;

Upvotes: 3

Related Questions