[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: RE: Reshape problem.
I doubt that your -reshape- is treating the explicit values
01 02 ... 10
literally as strings in the way you wish.
To Stata 01 02 ... is an acceptable way of specifying
1 2 ..., just as 0.1 is an acceptable way of
specifying .1, but that's not what you want.
Stata is looking in turn for variables of the form
<stub>1 <stub>2 ... <stub>10
but it only finds those of the form
<stub>10, hence the much reduced dataset you got.
So you really need the literal string interpretation "01" etc.
and there is a -string- option for this purpose.
Perhaps Stata should be better at catching this,
but it's quite tricky given Stata's general
Note also an explicit warning embedded within
"On occasion, people use numeric suffixes with leading zeros,
such as 01, 02, and so forth. -reshape- will understand
these properly only if they are declared as string."
In short, try
. reshape long $varx, i(wid) j string
> Hi Shigui,
> It is true. I am using a dhs data. I understand the figure
> but I think that once
> provide some summary statisctics, you will understand my problem:
> > . global varx "bidx_ bord_ b0_ b3_ b4_ b5_ b7_ b11_ "
> > . global varx2 "bidx bord b0 b3 b4 b5 b7 b11"
> > . reshape long $varx, i(wid) j(j 01 02 03 04 05 06 07 08 09 10)
* For searches and help try: