Statalist The Stata Listserver


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

st: RE: help in data manipulation (extraction of components in database and transposition of entries)


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: help in data manipulation (extraction of components in database and transposition of entries)
Date   Fri, 31 Mar 2006 16:43:50 +0100

In Stata this would be a -reshape-. Try 

reshape wide area , i(farm) j(commmodity) string 

Nick 
n.j.cox@durham.ac.uk 

Jose Ramon Albert
 
> i have a census data set of farming households that
> have on each
> "parcel" several sets of commodities planted... the
> database looks likes this:
> 
> farm  parcel    commodity          area    type
> 1       1           rice            2
> permanent
> 1       2           corn            3
> permanent
> 2       1           banana          5         temp
> 2       1           rice            3         temp
> 2       1           corn            4         temp
> 2       2           rice            10       permanent
> 2       2           corn           5         permanent
> 
> etc.
> 
> is it possible to have the STATA database look instead
> like this:
> 
> farm   parcel   rice area     corn area  barana area
> 1          1        2
> 1          2        .             3
> 2          1        3             4               5
> 2          2        10            5
> 
> 
> in principle, what's happening is that we select each
> unique parcel
> and extract the "data matrix"  and then transpose it...
> 
> can this be done in STATA or would it be faster to do
> this in another software instead?

*
*   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–2020 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index