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 looks like the table below?

animal   missing   number
Cat                9        
Dog                10       
Egg                11

      

+3


source to share


1 answer


You just need to include dsd

in your statement infile

as that means SAS has to handle two consecutive commas as the missing value. You can read more information here :



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

      

+3


source







All Articles