Hello, looking for some answers. Already looked at the help page for array statements, but couldn't see anything related to my issue. I'm examining the presence of an event over each month for the last two years, and have created a binary variable for each month ("1" if event was present, "0" if not). Basically, whenever there is a "1" present, I need to know how many months it lasts. For example, if month1, month2, and month3 all had 1's, I would need SAS to provide the number 3. The tricky part is that there can be multiple groupings for each case. For example, months 1 2 and 3 can all have "1", but months 19, 20, and 21 can also have "1"s. So, I would need SAS to tell me there were two separate instances for one case where the event lasted 3 months. I've tried using the following code someone else gave me to no avail: data new; set old; array months (24) month1-month24; do i=1 to 24 until (months(i) ne 0) ; if months(i)=0 then duration=i; end; run; What this does is create a variable "i", which identifies the first month for a case that a "1" appears, and the variable "duration," which identifies the month where the last "0" appeared. Any ideas on how to make this array do what I described ? Thanks so much.
... View more