IFN function - strange behaviour

Discussion in 'SAS (Statistical Analysis Software)' started by GuyA, Jan 15, 2009.

  1. GuyA

    GuyA Guest

    With the code below I would have expected incomplete_data1 and 2 to be
    the same, but they are not.

    incomplete_data1 is what I want (if there is any missing data then
    flag it), but using the IFN function it only seems to look at the
    final variable in the array.

    Am I misunderstanding something in IFN? This has rather shaken my
    confidence in using IFN or IFC for anything in future.

    Thanks.

    data input;
    infile datalines missover;
    input var1 var2 var3 var4 var5;
    datalines;
    0 1 6 2 1
    1 2 3 4 .
    1 2 3 . 5
    .. 0 5 6 2
    .. . . . .
    1 1 . . .
    8 98 2 8 2
    .. 1 2 . 5
    ;

    data output;
    set input;
    array fields _numeric_;
    do over fields;
    if missing(fields) then incomplete_data1=1;
    incomplete_data2=ifn(missing(fields),1,.);
    end;
    run;
     
    GuyA, Jan 15, 2009
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.