i will get data in excel and at times the data in the second row (first row being the header they become sas variable names in sas dataset) will be empty and starting from third row the data begins.so once we have the dataset the first record will be blank.
say if i have address field and some of the values can be missing for address field, but not the entire record. then we cannot use either your logic or mine.
but there is a chance that first record(all fields) can be blank, then how to delete?
They are almost the same except my version might be a litle faster because it wouldn't read the null record into the data step vector. This might work for you.
----------------------------------------------
data stuff;
x = "A"; y = 1; output;
x = " "; y = 1; output;
x = " "; y = .; output;
x = "B"; y = 1; output;
x = "C"; y = 1; output;
run;
data stuff;
set stuff;
if not missing(compress(cats(of _all_),'.'));
run;
this is cool. can y be of any data type?in your example it is numeric data type.
the reason for asking for datatype is in the if condition what does '.' do in the compress function?
I think this will work with any number of variables of any type.
I just had an example of one character and one numeric to show that it would work with both types. The CATS(_ALL_) will concatinate all of the variables in the data step vector into a single string. The numerics will be automatically converted to strings using a default format so the missing numerics will be a '.'. The missing characters will of course be blank. The compress( ,'.') removes those periods from the missing numerics, so if all of the values were missing all that will be left is spaces which MISSING is evalutate as true.