Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65044

If statements on multiple values of a variable

$
0
0
Hello

I have generated a variable Group=. and I would like to replace Group=="garden" if id equals 1, 5, 7, 12, 13, or 15 and Group=="control" if id equals 2, 3, 6, 8, 9, or 14. Could someone please let me know the easiest way to write if statements other than listing out every value of my variable id? I come across things like this a lot in my work so I'm looking for a solution that broadly apply to similar situations.

Thanks!

Viewing all articles
Browse latest Browse all 65044

Trending Articles