Page 1 of 1

Count value in a series with some condition

Posted: Tue Aug 21, 2018 1:15 am
by Lalan_dk
Hi,

I have 15000 household data that have some member in every houshold. I want to count the number of household member that have age more than 60 years old in every houshold.

What command that should i use?
Thx

Re: Count value in a series with some condition

Posted: Tue Aug 21, 2018 6:20 am
by EViews Gareth

Code: Select all

Smpl if age>60
=@obssmpl

Re: Count value in a series with some condition

Posted: Tue Aug 21, 2018 8:39 am
by startz
If what you meant was separate counts for each household, something like

Code: Select all

smpl if age>60
count = @obsby(householdID,householdid)

Re: Count value in a series with some condition

Posted: Wed Aug 22, 2018 10:13 am
by Lalan_dk
Thank you Glenn and startz