mardi 28 avril 2020

what's the difference on dealing char between where statement and if statement in SAS 9.4M6

Recently, I happen to find an interesting thing:

data test;
    set sashelp.class;
    if _N_ in (2 3 5 7) then name = '';
run;

data test;
    set ;
    where name;
run;

The result is: data Test has 15 observations.

I use SAS 9.4M6 for over a year and don't remember that where statment can deal with char type variable just like boolean type variable. I strightly change where to if and it leads the results: name is not a numeric variable and data Test has 0 observation.

So here is my two questions:
1. Is where name; another way of where name is not missing? if not, what happens when submitwhere name?
2. When did this kind of code(where <variable>;) start be allowed in SAS?

Thanks for any tips.

Aucun commentaire:

Enregistrer un commentaire