Hi:
Certain SAS procedures (like PROC TABULATE or PROC MEANS for example) allow the use of "multi-label" formats for the purpose of counting a single observation in more than one category.
If you look in the documentation under these topics:
The TABULATE Procedure: Using Multilabel Formats
The MEANS Procedure: Using Multilabel Value Formats with Class Variables
You will find an example for each procedure that shows how to use Multi-label formats specifically in these procedures.
When you use an ELSE IF type of condition, think of the observation as being a single pinball in a pinball machine. It can only bounce into one category. As soon as the observation meets the first condition (in your case, the first cohort) then the observation "exits" the entire IF/ELSE syntax structure...no other tests are done for that observation. But, if you change to a series of single IF statements (without an ELSE), while the same observation would be tested multiple times, you only have a single COHORT variable...so now the COHORT value would be the LAST condition that was met -- which would still not be what you want.
If you need an external variable which will uniquely identify all the cohorts that a person "qualifies" for based on their age, then you might consider something like this, where you create a "string" variable whose value is a series of 0 or 1 based on which cohort or cohorts a person's age falls into:
[pre]
1234567 <---- position of cohort group in string
0000000 <----- obs not in any cohort group
1000000 = ONLY cohort 1
1100000 = ONLY cohort 1 and 2
0110000 = only cohort 2 and 3
0011000 = only cohort 3 and 4, etc
etc, etc
[/pre]
Or, you could build a string of Y and N. There are probably many different ways to set categories, using Multi-Label Formats or a string of 0 and 1 are what I see a lot.
cynthia