Sample
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Non-normality and collinearity are NOT problems!
- Posts: 3775
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Sample
I'm afraid I'm stumped too.
-
- EViews Developer
- Posts: 560
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Sample
Hello,
I believe the fundamental problem is that information about a household with children is split across several observations. Without making any assumptions about how the observations for a single household are related (I notice they're two apart in your example, but I don't know if that pattern is always true), you need to (1) identify the household codes for the households with children in the desired age range, and (2) filter/sample by those household codes. For example, assuming all households have a boss (so we don't have to check for a boss):
I believe the fundamental problem is that information about a household with children is split across several observations. Without making any assumptions about how the observations for a single household are related (I notice they're two apart in your example, but I don't know if that pattern is always true), you need to (1) identify the household codes for the households with children in the desired age range, and (2) filter/sample by those household codes. For example, assuming all households have a boss (so we don't have to check for a boss):
Code: Select all
' Find all children of the desired age
smpl @all if cho03 = 3 and cho06 >= 18 and cho06 <= 30
' Create a string containing all the household codes associated with those children.
string codes = @wjoin(@uniquevals(a5))
' Show only the households with the matching codes.
smpl @all if @instr(codes, a5) <> 0
Re: Sample
EViews Matt wrote:Hello,
I believe the fundamental problem is that information about a household with children is split across several observations. Without making any assumptions about how the observations for a single household are related (I notice they're two apart in your example, but I don't know if that pattern is always true), you need to (1) identify the household codes for the households with children in the desired age range, and (2) filter/sample by those household codes. For example, assuming all households have a boss (so we don't have to check for a boss):Code: Select all
' Find all children of the desired age
smpl @all if cho03 = 3 and cho06 >= 18 and cho06 <= 30
' Create a string containing all the household codes associated with those children.
string codes = @wjoin(@uniquevals(a5))
' Show only the households with the matching codes.
smpl @all if @instr(codes, a5) <> 0
When I try to make the second step, there is a sign that says: "incorrect numbers of arguments"
-
- EViews Developer
- Posts: 560
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Sample
I don't have a copy of EViews 7 handy, but I now realize @wjoin and @uniquevals probably weren't in that version. You can replace that second statement with something equivalent:
Code: Select all
svector tmp
stom(a5, tmp)
string codes = ""
for !i = 1 to @rows(tmp)
if @instr(codes, tmp(!i)) = 0 then
codes = codes + tmp(!i) + " "
endif
next
delete tmp
Who is online
Users browsing this forum: No registered users and 10 guests