Im looking for a way to loop through variables (eg week01 to week52) and count the number of times the value changes across the them. For example week01 to week18 may be coded as 1 week19 to week40 may be coded as 4 and week 41 to 52 may be coded as 3
That would be 2 transistions within the data.
How could i go about writing a code that can find me this information? I'm rather new to this and some help to get me in the right direction would be very appreciated.