Search found 1 match
- Wed Aug 02, 2023 10:14 am
- Forum: Data Manipulation
- Topic: Count number of dummy variables
- Replies: 1
- Views: 46300
Count number of dummy variables
Hi, I have a dummy variable that is either 1 or NA called "below50". I want to create a series that counts how many consecutive 1's there are and returns to 0 when it encounters an NA. EX: below50 CUM NA 0 NA 0 NA 0 1 1 1 2 1 3 1 4 NA 0 NA 0 NA 0 1 1 NA 0 As a second job I would also like ...
