SAS 9.4 How to quickly check for all data / variables -
sorry don't know if there previous questions ask problem. if there is, please show me link :)
similar question check if there missing values , place '0' missing values.
data new; set old; array change _numeric_; on change; if change = . change = 0; end; run;
i wondering if want check data/variable positive or not:
data new; set old; array change _numeric_; on change; if change <= 0 change = 0; if change > 0 change = 1; end; run;
but doesn't expected. can do?
and then, thinking if there quick way represent data/variable. i.e.
data new; set old; if _all_ <= 0 ... = 0; if _all_ > 0 ... = 1; run;
something this.
your basic concept should work, looks syntax isn't quite right. you're creating 0,1 flag, can simplify code follows (you don't need if
,then
,else
statement).
this change each individual value. i'm not sure mean second point, saying if values negative or positive change them? if so, in row or column?
data old; input b c; datalines; -2 3 0 3 5 9 1 0 -5 4 7 -8 ; run; data new; set old; array change{*} _numeric_; = 1 dim(change); change{i} = change{i}>0; end; drop i; run;
Comments
Post a Comment