Hello everyone!
Please help me on this, I am really desperate by now.
So I have a dataset (attached photo) and the regression I am trying to get would be reg hcount visit county
however, I am trying to get all visit_id (visit_A, visit_B..) under one var visit with all i observations. and Same for hcount_id..
so I did :
reshape long hcounts_, i(county) j(id) string
But then I get an error message :
variable id does not uniquely identify the observations
Your data are currently wide. You are performing a reshape
long. You specified i(county) and j(id). In the current wide
form, variable county should uniquely identify the
observations.
I think this is due to the fact that for each county (Houston, Stjohns...) I have each written multiple times : so I have Houston Houston Houston....
So does anyone know how I can create a UNIQUE non string dummy variable for each county ?
ie, Houston =1 if county=houston
Please help me on this, I am really desperate by now.
So I have a dataset (attached photo) and the regression I am trying to get would be reg hcount visit county
however, I am trying to get all visit_id (visit_A, visit_B..) under one var visit with all i observations. and Same for hcount_id..
so I did :
reshape long hcounts_, i(county) j(id) string
But then I get an error message :
variable id does not uniquely identify the observations
Your data are currently wide. You are performing a reshape
long. You specified i(county) and j(id). In the current wide
form, variable county should uniquely identify the
observations.
I think this is due to the fact that for each county (Houston, Stjohns...) I have each written multiple times : so I have Houston Houston Houston....
So does anyone know how I can create a UNIQUE non string dummy variable for each county ?
ie, Houston =1 if county=houston
Comment