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
0 Response to Bysort Trouble
Post a Comment