I am trying to loop over a list of integer variables to replace missing values. I am using the following code
Code:
qui: ds S* PA* PB* PC* BST* H1* H2* H3* H4* H5*, not(type string) local Int_vars `r(varlist)' foreach v of local Int_vars { egen max_var = max(`v') - 4 replace `v' = . if max_var>`v' drop max_var }
What part of my code am I getting wrong?
Thanks!
0 Response to Looping of a specific type of a variable list
Post a Comment