Hi.
I'm a beginner and working with Census data. My variables are LOCATION SEX AGE YEAR1, YEAR2, etc..... YEAR20 and I have ages 1-90. My goal is to collapse the ages 80+ into one row but maintain all other ages in their own row. In the end I'll have rows for ages 1, 2, 3, ..... 78, 79, 80+.
I am wondering if there is a way to combine the "if" statement and the collapse command?
The syntax I was using was something like
sort LOCATION SEX AGE
collapse (sum) varlist, by(LOCATION SEX AGE) if AGE>79
But getting errors that if option is not allowed. Thoughts?
I'm a beginner and working with Census data. My variables are LOCATION SEX AGE YEAR1, YEAR2, etc..... YEAR20 and I have ages 1-90. My goal is to collapse the ages 80+ into one row but maintain all other ages in their own row. In the end I'll have rows for ages 1, 2, 3, ..... 78, 79, 80+.
I am wondering if there is a way to combine the "if" statement and the collapse command?
The syntax I was using was something like
sort LOCATION SEX AGE
collapse (sum) varlist, by(LOCATION SEX AGE) if AGE>79
But getting errors that if option is not allowed. Thoughts?