Sample

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator

mpsc19
Posts: 24
Joined: Mon Jul 10, 2017 8:41 am

Sample

Postby mpsc19 » Mon Oct 16, 2017 5:29 am

Hello, how can I reduce a sample by looking only at households with a boss and children between the ages of 18 and 30? Households with bosses but no children with those ages do not interest me

boss: ch03=1
children: ch03=3
between ages of 19 and 30: (ch06>=18 and ch06<=30)

I previously did this: (ch03=1 or (ch03=3 and ch06>=18 and ch06<=30)) but also appear households with bosses alone, that is, if the "x" household has a boss with 15 year old children, he shows me that same home but only shows me the boss, and this does not help me, I do not want to see that home

Sorry for my english. Using Eviews 7

startz
Non-normality and collinearity are NOT problems!
Posts: 3265
Joined: Wed Sep 17, 2008 2:25 pm

Re: Sample

Postby startz » Mon Oct 16, 2017 6:14 am

Try changing "or" to "and"

mpsc19
Posts: 24
Joined: Mon Jul 10, 2017 8:41 am

Re: Sample

Postby mpsc19 » Mon Oct 16, 2017 6:18 am

There I did but no, only the bosses are now

startz
Non-normality and collinearity are NOT problems!
Posts: 3265
Joined: Wed Sep 17, 2008 2:25 pm

Re: Sample

Postby startz » Mon Oct 16, 2017 6:22 am

How is your data structured?

mpsc19
Posts: 24
Joined: Mon Jul 10, 2017 8:41 am

Re: Sample

Postby mpsc19 » Mon Oct 16, 2017 6:25 am

Unstructured/Undated

startz
Non-normality and collinearity are NOT problems!
Posts: 3265
Joined: Wed Sep 17, 2008 2:25 pm

Re: Sample

Postby startz » Mon Oct 16, 2017 6:50 am

Ah, you can't very well have ch03 take on two different values in one observation. So how can an observation be both boss and children?

mpsc19
Posts: 24
Joined: Mon Jul 10, 2017 8:41 am

Re: Sample

Postby mpsc19 » Mon Oct 16, 2017 6:57 am

I'm trying to sort the information to make a data panel. I don't want a single observation to take two values, I just want to reduce the sample to show me only the households where there is a boss and children with those ages

startz
Non-normality and collinearity are NOT problems!
Posts: 3265
Joined: Wed Sep 17, 2008 2:25 pm

Re: Sample

Postby startz » Mon Oct 16, 2017 8:06 am

I suspect, but don't know, that you have separate observations for each household member. If that's so, how are they linked?

mpsc19
Posts: 24
Joined: Mon Jul 10, 2017 8:41 am

Re: Sample

Postby mpsc19 » Mon Oct 16, 2017 8:32 am

Yes, for example, the code of a household is: 257695 .the variable that has the codes of the homes is called "codusu"
In a house there may be more than one family, every family has its code, the variable that has the family codes is "nro_hogar"
In each family there is an individual, if there is a boss, is assigned the number 1, if there is a spouse, is assigned the number 2, the children is assigned the number 3 and so ... the variable that assigns the number to each individual is called a "componente"

what I did to link the three variables is:

series a4=@val(codusu)
alpha a5=@str(a4)+@str(nro_hogar) + @str(componente)

in this way, the code would be, for example: 25769511 if I am seeing the head of the family 1 of that home


in the other post where I showed what I did, I use the variable "ch03" which is the one that shows the relations of kinship, which in this case, coincides with the variable "componente"

startz
Non-normality and collinearity are NOT problems!
Posts: 3265
Joined: Wed Sep 17, 2008 2:25 pm

Re: Sample

Postby startz » Mon Oct 16, 2017 9:17 am

The problem would seem to be that if you are looking at the record for a spouse or someone else, there is nothing in that record which indicates that another record has a boss.

mpsc19
Posts: 24
Joined: Mon Jul 10, 2017 8:41 am

Re: Sample

Postby mpsc19 » Mon Oct 16, 2017 9:51 am

Mmmm, ok, I understand what you say, but I know all records have a boss. no way to do it?

startz
Non-normality and collinearity are NOT problems!
Posts: 3265
Joined: Wed Sep 17, 2008 2:25 pm

Re: Sample

Postby startz » Mon Oct 16, 2017 9:53 am

I don't think I understand. If all records have a boss, then why do you have to check whether they have a boss?

mpsc19
Posts: 24
Joined: Mon Jul 10, 2017 8:41 am

Re: Sample

Postby mpsc19 » Mon Oct 16, 2017 10:06 am

Look, i put this: smpl @all if (ch03=1 or (ch03=3 and ch06>=18 and ch06<=30))
then I have all the households with heads that have children between 18 and 30 years, but also appear the heads of other households that do not meet that condition, for example, in the image the first ten observations are from households that do not have children between those ages, until, for example, it shows that at home 1252151 (codusu + nro_hogar) there is a boss who has a child between those ages, I just want to see in that square only these homes (like 1253361, 1253661) not households as the top 10

Jefe= boss
Hijo/hijastro= child


Image

startz
Non-normality and collinearity are NOT problems!
Posts: 3265
Joined: Wed Sep 17, 2008 2:25 pm

Re: Sample

Postby startz » Mon Oct 16, 2017 10:12 am

Does

Code: Select all

 smpl @all if (ch03=1 and ch06>=18 and ch06<=30) or (ch03=3 and ch06>=18 and ch06<=30)

do what you want?

mpsc19
Posts: 24
Joined: Mon Jul 10, 2017 8:41 am

Re: Sample

Postby mpsc19 » Mon Oct 16, 2017 10:18 am

No :(
I also appreciate your help, very kind !!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 7 guests