Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: A problem with reshape


From   Conor Hughes <[email protected]>
To   [email protected]
Subject   Re: st: A problem with reshape
Date   Sun, 14 Jul 2013 18:09:29 -0400

Stata is looking for a variable called "group". There is no such
variable in the example data you provided. If you did create a group
variable, please post the code you used to create it as well.

Best,
Conor

On Sun, Jul 14, 2013 at 6:00 PM, ofran almossawi
<[email protected]> wrote:
> Hello
> I am having some problems with reshape. my data set is rather large
> and i cannot make the changes by hand.
> I have data that have no unique identifier, see example of my data below:
>
> id   disease   type
>
> 1     A              comorbidity
> 1     B              primary
> 1     C             comorbidity
> 2     D             primary
> 2     E              secondary
> 2     F             comorbidity
> 3     G             primary
> 3     H              comorbidity
> 3     I                comorbidity
> 3     J              comorbidity
>
> the problem that i am having is creating comorbidity 1, 2, 3 etc and
> reshaping the data into wide format.
>
> I have followed the example at
> http://www.stata.com/support/faqs/data-management/problems-with-reshape/
>
> but when I get to the line "by group, sort: replace no = _n" I get a
> "0 replacements made" message.
>
> I am not sure where I am going wrong with this or if there is a better
> way of doing it.
>
> many thanks in advance.
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index