Hello,
I am attempting to execute a very simple command where I create a new variable for each id (appearing many times in my data) corresponding to the first year that id appears in the data. My code is as follows:
bysort id: egen(first_year)=min(year)
Year is a numerical variable. However, I am getting the error "( invalid name, r;198". I have run similar commands in Stata countless times without any issues, so I am not sure what the problem is.
I also tried
by id: egen(first_year)=min(year)
but was met with the same error.
Any ideas?
Thanks in advance,
Erik
Related Posts with Bysort Trouble
Problem with betamixI am having a problem with betamix. Our dependent variable has a distribution whose characteristics …
Possible bug in -bootstrap-Currently, I only have access to Stata 11 to 14. In these releases, there appears to be a bug in boo…
Dealing with zero valuesHello, I am working on the effect of social transfers (pensions and other social benefits) on middle…
Collapsing survival dataDear all, I have a very big data set with a survival structure that I want to compress/collapse. Ri…
Open password protected ".dta" file (I have the password)Dear All, I have received data files (.dta) which is protected with a password (I have the password…
Subscribe to:
Post Comments (Atom)
0 Response to Bysort Trouble
Post a Comment