You are not logged in. You can browse but not post. Login or Register by clicking 'Login or Register' at the top-right of this page. For more information on Statalist, see the FAQ.
There are two possibilities. Even though the id variable may be duplicated, it may be that some combination of id and some other variable(s) will uniquely identify observation. For example, in panel data, the combination of id and date will usually identify observations. When specifying -reshape- you can put a whole list of variables in the -i()- option if that it was is needed to identify unique observations.
If the nature of the data is such that no combination of variables will uniquely identify observations you can do:
Code:
gen long obs_no = _n
reshape long whatever, i(obs_no) j(some_new_variable_name)
One word of caution: it is perfectly OK for a data set to lack any variables that jointly uniquely identify observations. But it is uncommon for this to happen. So if you really don't have any such identifying variable combination, double-check to make sure your data set is complete and correct--it may be a sign that something went wrong when the data set was created.
Added: Crossed with #2 which shows a somewhat different approach.
Comment