Statalist The Stata Listserver


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

RE: st: Re: reshape when the stub is at the beginning of the variables


From   Carol Bao <yanjunbb@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   RE: st: Re: reshape when the stub is at the beginning of the variables
Date   Fri, 28 Apr 2006 21:30:22 -0700 (PDT)

Dear all:

Thank you so much for chipping in to help with your
great ideas and suggestions.  I forwarded all your
messages to my friend and it is a great discussion for
me as well.  I will keep you posted as to how this
turns out.

Again, thanks,

Carol

--- Nick Cox <n.j.cox@durham.ac.uk> wrote:

> I agree. That is, there would be need to be a way 
> to tell Stata about the mapping, as it would be 
> unfair to expect Stata to infer rules we didn't tell
> 
> it. And the way seems to be renaming, which is where
> we were a while back. 
> 
> Whether the variables mean much is a totally
> different issue. 
> 
> Nick 
> n.j.cox@durham.ac.uk 
> 
> Ada Ma
>  
> > Thanks Nick for the answer.  I asked becoz I was
> thinking that there
> > may be a way to tell Stata that A=1 and B=2, so on
> and so forth.  The
> > wave variables in the original data set are
> frivolous anyway - the
> > SMOK variables being missing whenever the person
> failed to respond in
> > that wave.
>  
> > On 4/26/06, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> > > I don't think so; but I can't prove that
> > >
> > > But turn it round. What are you expecting?
> > >
> > > That -reshape- should
> > > somehow realise that A matches 1, B matches
> > > 2, C matches 3?
> > >
> > > What would you expect -reshape- to do if the
> > > variables were
> > >
> > > ID WaveX WaveY WaveZ ASMOK BSMOK CSMOK
> > >
> > > That one works, but not in the same way.
> > >
> > > Nick
> > > n.j.cox@durham.ac.uk
> > >
> > > > -----Original Message-----
> > > > From: owner-statalist@hsphsun2.harvard.edu
> > > >
> [mailto:owner-statalist@hsphsun2.harvard.edu]On
> Behalf Of Ada Ma
> > > >
> > > > Carol Bao's friend data set looks interesting.
>  I had not 
> > noticed the
> > > > atwl option before.  If the variable names
> were:
> > > > ID   WaveA WaveB WaveC ASMOK BSMOK CSMOK
> > > >
> > > > I could have reshaped it long in one shot:
> > > > reshape long @SMOK Wave, i(ID) j(type) atwl()
> string
> > > >
> > > > But unfortunate they are not, they are:
> > > > ID   Wave1 Wave2 Wave3 ASMOK BSMOK CSMOK
> > > >
> > > > Is it still possible to reshape both the Wave
> variables 
> > and the SMOK
> > > > variables in one shot?
> > > >
> > > >
> > > >
> > > > On 4/26/06, Michael Blasnik
> <michael.blasnik@verizon.net> wrote:
> > > > > Check out the advanced syntax for reshape. 
> I believe that
> > > > you can specify
> > > > > the location of the "j" part of the variable
> names using
> > > > the @ symbol.  I
> > > > > haven't used this option in a while, but I
> think you will
> > > > need to specify
> > > > > that the j variable is a string and may need
> to use the
> > > > atwl() option for
> > > > > the reshape xij line.
> > > > >
> > > > > reshape xij @SMOK
> > > > >
> > > > > Michael Blasnik
> > > > > michael.blasnik@verizon.net
> > > > >
> > > > > ----- Original Message -----
> > > > > From: "Carol Bao" <yanjunbb@yahoo.com>
> > > > > To: <statalist@hsphsun2.harvard.edu>
> > > > > Cc: <nmani1@uic.edu>
> > > > > Sent: Tuesday, April 25, 2006 7:01 PM
> > > > > Subject: st: reshape when the stub is at the
> beginning of
> > > > the variables
> > > > >
> > > > >
> > > > > > Hi, I am asking this for a friend:
> > > > > >
> > > > > > She has a data set in its wide form like
> this:
> > > > > >
> > > > > > ID   Wave1 Wave2 Wave3 ASMOK BSMOK CSMOK
> > > > > > 1     0      1     1    .      1     0
> > > > > > 2     1      1     0    1      0     .
> > > > > >
> > > > > > Which reads: for person 1, he/she appears
> in wave 2
> > > > > > and wave 3 of the survey and reports to
> smoke in wave
> > > > > > 2 (BSMOK) and not smoke in wave 3 (CSMOK).
>  For person
> > > > > > 2, he/she is interviewed in wave 1 and 2
> but drops out
> > > > > > in wave 3 and reports to smoke in wave 1
> and not in
> > > > > > wave 2.
> > > > > >
> > > > > > The question is, the stub for reshape into
> variable
> > > > > > SMOK appears at the beginning of the
> variables as A, B
> > > > > > and C respectively for three waves (all
> the other
> > > > > > variables as well).  Is there any easier
> way to
> > > > > > reshape the data? Or any suggestions?
> 
> *
> *   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/
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index