Masanja,
Does the fact that your caseid var goes b1_01, b1_02 ... mean you work with
a panel? If that's the case then I think in the command suggested by Nick
you should add the periods as in:
reshape long b1 b2 b3 b4 b5 b6 b7, i(caseid) j(timevar t1 t2 ...) string
hope that helps
Panos
-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: 20 November 2006 13:44
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: Reshape for DHS data file
Sorry, but I have no idea of what "Demographic
and Health Survey" implies here, if anything.
On the face of it, your stubs are
b1 b2 b3 b4 b5 b6 b7
your suffixes are string, and your example is already
in suitable form. In any case it is a good idea
to indicate what you have tried to date and what you
find unclear so that you are asking this question.
I guess
reshape long b1 b2 b3 b4 b5 b6 b7, i(caseid) string
If that's not the solution, you should study the
help and also
I am having problems with the reshape command. Can
you give further guidance?
http://www.stata.com/support/faqs/data/reshape3.html
thoroughly before returning to the list.
Nick
n.j.cox@durham.ac.uk
Masanja
> I have a Demographic and Health Survey dataset (see variables below)
> which I would like to reshape from wide to long format. Any assistance
> would be much appreciated
>
> str caseid 1: 1-15
> long v005 1: 38-45
> byte v006 1: 46-47
> int v007 1: 48-51
> int v008 1: 52-55
> byte b1_01 1: 222-223
> int b2_01 1: 224-227
> int b3_01 1: 228-231
> byte b4_01 1: 232-232
> byte b5_01 1: 233-233
> int b6_01 1: 234-236
> int b7_01 1: 237-239
> byte b1_02 1: 259-260
> int b2_02 1: 261-264
> int b3_02 1: 265-268
> byte b4_02 1: 269-269
> byte b5_02 1: 270-270
> int b6_02 1: 271-273
> int b7_02 1: 274-276
> byte b1_03 1: 296-297
> int b2_03 1: 298-301
> int b3_03 1: 302-305
> byte b4_03 1: 306-306
> byte b5_03 1: 307-307
> int b6_03 1: 308-310
> int b7_03 1: 311-313
*
* 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/