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
Regression and Outreg2 variable label displayHello I am running a normal regression and i labeled my variables and their values (they are all cat…
Reporting R-squared values in System GMM estimationHi everyone, This is a query on how to report the R-squared (or Adjusted R-squared) value in a syst…
Using svyset for melogitHello, I am analyzing a binary outcome (depvar) using melogit so that I may 1) account for the comp…
Wildcards with noccurHi there, Can I use wildcards with the egen function noccur? If not, is there another way to use wi…
How can I extract a portion of a string variable using regular expressions?Hi everyone! Thanks in advance for your time and help. I have the following problem....Some of the …
Subscribe to:
Post Comments (Atom)
0 Response to Bysort Trouble
Post a Comment