Saturday, June 8, 2019

Loops for creating categorical variables using different cutoff

Hi,
I have 842 continuous variables and I need to turn them into a catagorical variable. Each of them has its own cutoff value (I got the cutoff value by using cutpt command in a loop).
I know how to do this for one variable without a loop using the gen and replace commands and then assigning labels to the values but I don't know how to write a loop without typing cutoff value.
Can someone assist me with how to accomplish this more quickly using a loop for all 842 variables? thank you!

No comments:

Post a Comment