Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: reshape


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: reshape
Date   Wed, 22 Oct 2003 13:51:34 +0100

What little SPSS syntax I ever knew I forgot
many years ago. It seems heavy on upper case.
More crucially, I am not clear on what your
data structure and variable names are within Stata.

However, the key to -reshape- in Stata is that
it works on stubnames (not wildcards).
Various recent threads have stemmed on this one
point. If your variables are (say)

a1 a2 a3
b1 b2 b3

then the stubnames are

a
b

and a very common -reshape- would look like

reshape long a b , i(id)

There is a supplement to [R] reshape
at
http://www.stata.com/support/faqs/data/reshape3.html


Nick
[email protected]

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of ann
> fitzmaurice
>
> i am trying to use reshape
>
> i have beein using an alternative program for data manipulation  and
> analysis using stata
>
> i have a data set with 16 variables that occur several times
>
> what i want to do is for each associated group of variables
> i want to use
> reshape to make one variable and repeat for each group of
> variables ,
> there are other variables in the data set which would then
> effectively be
> stacked upon each other
>
> i  show the start of the spss restructure to demonstrate
>
> VARSTOCASES /ID = id
>  /MAKE trans1 FROM mmidx$01 mmidx$02 mmidx$03 mmidx$04
> mmidx$05 mmidx$06
>   mmidx$07 mmidx$08 mmidx$09 mmidx$10 mmidx$11 mmidx$12
> mmidx$13 mmidx$14
>   mmidx$15 mmidx$16 mmidx$17 mmidx$18 mmidx$19 mmidx$20
>  /MAKE trans2 FROM mm1$01 mm1$02 mm1$03 mm1$04 mm1$05
> mm1$06 mm1$07 mm1$08
>   mm1$09 mm1$10 mm1$11 mm1$12 mm1$13 mm1$14 mm1$15 mm1$16
> mm1$17 mm1$18
> mm1$19
>   mm1$20
>  the new trans variables are what i am trying to achieve in
> stata , i
> presume that the use of wildcards will cut down the command
>

*
*   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