[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: reshape wide - conversion problem

From   Joseph McDonnell <>
Subject   Re: st: reshape wide - conversion problem
Date   Sun, 12 Apr 2009 17:22:27 +0930


I'm not sure I understand what you are saying but I'll have a crack.
You could define an indicator within the combination (opioid_id,
contact) and reshape using that.

. sort opioid_id contact
. by opioid_id contact: generate recno=_n
. reshape wide relevant_data_stubnames, i(opioid_id) j(recno)

Hope this helps.


On Sun, Apr 12, 2009 at 3:16 PM, John Henshaw <> wrote:
> I am studying monthly opioid use (opioid_id) and haelthcare use (contacts) in the community.
> My data is in long form but I wish to declare it as panel data and need to convert to wide form.
> I have a unique opioid_id but my contacts variables for each opioid_id are often not unique.
> Therefore i(opioid_id) j(contacts) is not unique and reshape wide fails
> Is there a solution to this?
> Thankyou John Henshaw (University of Tasmania)
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index