Hi all,
I have a dataset with around 98 variables. The variables are a mix of both character and numeric variables. The variables in the dataset are in a fixed order.
I would like to select only variables #42 through #91, but keep the observations (or rows) that do not have missing data. Since variables #42 through #91 are both Character and Numeric variables, missing data has been identified as either "." or " ".
Essentially, I still need every single variable (Variables # 1 through #98), but want to drop any observations based on missingness conditioning on variables 42-91.
I've tried to do the code below but ended up with 0 observations (based on visual inspection alone I should have some rows left):
*Using Variable Names;
data want;
set have;
if ("nameofvariable42" -- "nameofvariable91") = . or " " then delete;
run;
*Using Variable Numbers;
data want;
set have;
if (varnum between 42 and 91) = . or " " then delete;
run;
I've tried it in both methods (using the variable names & using the variable numbers) and ended up with the same result.
An error in the log stated that character values were converted to numeric. Not sure if this has something to do with combining both Character and Numeric variables at the same time...
In any case, any help would be much appreciated!
Thanks,
AG