Hi,
I'm using the following forval command from: How do I create variables summarizing for each individual properties of the other members of a group? Stata FAQ
The error I get is 'is not a valid command' on the line 'qui by IDHH (ischild), sort:'
Does someone know what's wrong? I'm new to Stata and have never dealt with forval before. I am writing this code straight into the state command window and not a do file.
Thanks in advance
I'm using the following forval command from: How do I create variables summarizing for each individual properties of the other members of a group? Stata FAQ
Code:
summarize PERSONID, meanonly forval i = 1 / `r(max)' { replace ischild = (RO9 == `i') | (RO10 == `i') qui by IDHH (ischild), sort: replace ownchild = cond(RO10[_N] == `i', mchild[_N], fchild[_N]) if PERSONID == `i' & ischild[_N] }
Does someone know what's wrong? I'm new to Stata and have never dealt with forval before. I am writing this code straight into the state command window and not a do file.
Thanks in advance
Comment