Page 1 of 1

Generate series by sort

Posted: Wed Apr 11, 2018 6:54 pm
by Lalan_dk
Hello

I'm using IFLS data that contains more than 15000 household data and every household has some person. I want to get the oldest age of person in every household. My friend teach me to use stata with syntax:

Code: Select all

 Bysort hhid14: egen maxage=max(age)


With hhid14 is household id
maxage is series to be generated (maximum age of every household)
age is the age data of every person

But i'm not a stata user. I'm eviews user. And i can't find the bysort command in eviews.

How can i generate series like that? Or there is same bysort command in eviews with different name or word?

Re: Generate series by sort

Posted: Wed Apr 11, 2018 7:40 pm
by startz
Look at @maxsby in the help system.

Re: Generate series by sort

Posted: Wed Apr 11, 2018 10:45 pm
by Lalan_dk
Ok, thank you startz..

Then, if I would like to generate lagged series in every household, what command that should I use?

like: if a household has 5 members, and their age is 1; 2; 3; 4; 5, I would like to make series that contain age(-1), that is NA;1;2;3;4. The household id is an alphanumeric (text) data and i want to do this for more than 15000 household. please help

Re: Generate series by sort

Posted: Thu Apr 12, 2018 6:10 am
by startz
That one's a little harder, something like

Code: Select all

series laggedage = @recode(householdid = householdid(-1),age(-1),na)_