Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: reshape problem


From   "Eva Poen" <[email protected]>
To   [email protected]
Subject   Re: st: reshape problem
Date   Thu, 15 May 2008 11:57:59 +0100

Simon,

the "j" variable should be the counter/identifier of the investment
program. Your data may look like this:

. list

     +------------------------+
     | ID   Program    X    Y |
     |------------------------|
  1. |  1       101   85   27 |
  2. |  1       201    2    4 |
  3. |  2       101   45    9 |
     +------------------------+

where "ID" is the person identifier and "Program" is the program identifiert.
Then you can do

-reshape wide X Y, i(ID) j(Program)-

and you end up with the data in wide format:

     +--------------------------------+
     | ID   X101   Y101   X201   Y201 |
     |--------------------------------|
  1. |  1     85     27      2      4 |
  2. |  2     45      9      .      . |
     +--------------------------------+

If you don't have a program identifier, you need to create one first.
You cannot reshape without it.

Hope this helps.
Eva

2008/5/15 Simon Oertel <[email protected]>:
> Dear Stata Users,
>
> my dataset contains 4000 observations. Each subject in the dataset is
> member of an investment program, while some subjects join more than one
> program. So in total my dataset is based on 3232 subjects; some of them
> registered two or more times based on different investment programs.
>
> However, I would like to use the reshape command to restructure my data
> from long to wide but I always get the message "... takes to many
> values". The variable I would like to use as "j" in the reshape command
> is unique for each subject.
>
> Is there another way to restructure my data - besides reshape, or any
> other solution for my problem?
>
> Thanks for your answers.
> Simon
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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