Reputation: 77
I am trying to run a proc logistic regression. I have a lot of predictors which start with 'ST' and 'RF'. So I wrote the model statement like this
proc logistic data=x outest=y;
model binary_variable (event='1')= age sex RF: ST: lackfit;
output out=x p=fitted_prob predprob=individual ;
run;
I have fed this statement inside a macro and running this macro for multiple scenarios. I encountered few datasets where there was no column starting with ST, and the proc logistic threw an error, which goes like this
WARNING: No variables found beginning with 'ST' in data set
NOTE: The SAS System stopped processing this step because of errors.
If there a way to handle such exceptions? Some kind of parameter inside proc logistic? Thanks!
Upvotes: 0
Views: 38
Reputation: 9569
Within your macro, add some logic that detects whether each input dataset contains any columns starting with these prefixes and add the corresponding wildcards to the model statement only if at least one such column is present. You can get this information from sashelp.vcolumn
or the proc sql equivalent dictionary.columns
.
Upvotes: 1