Hi Statalist,

I have question regarding the binary variable. This is the example of my data.
Code:

Code:
input int str4 str4 str4 str4 str4 (ID grp1 grp2 grp3 grp4 grp5)
1 L30D I31A G10H J14I B25D
2 I31A V67Z L30D K25M O29H
3 F13W H76E P66Q M43F A12D
4 P14F V20K I36M O16F M35I
5 Q24R E38V H84A L30D W59M
6 I46R L30D M36T H99R L30D
7 L30D B36T L30D L30D N78Z
end
How can I create a binary variable for each ID that takes the value of "1" if the "grp*" variables have the "L30D" value, and "0" otherwise? And how can I do it if i have 1000 "grp*" variables in stead of just 5 in this example?

Thank you so much for your help