Friedrich,
thank you very much for your help! It works
Sara
--- Lun 13/10/08, Friedrich Huebler <[email protected]> ha scritto:
> Da: Friedrich Huebler <[email protected]>
> Oggetto: Re: st: transform the dataset structure
> A: [email protected]
> Data: Lunedì 13 ottobre 2008, 18:59
> Sara,
>
> Use -reshape-. There are probably shorter solutions than
> mine.
>
> Friedrich
>
>
> . flist, noobs
>
> +-------------------------------------------+
> | year italy france germany |
> |-------------------------------------------|
> | 1980 209 349 256 |
> | 1981 567 235 980 |
> | 1982 129 567 100 |
> +-------------------------------------------+
>
> . ren italy expenditure1
> . ren france expenditure2
> . ren germany expenditure3
> . reshape long expenditure, i(year) j(country)
> . lab def country 1 "Italy" 2 "France"
> 3 "Germany"
> . lab val country country
> . sort country year
> . flist, noobs sep(0)
>
> +---------------------------------+
> | year country expend~e |
> |---------------------------------|
> | 1980 Italy 209 |
> | 1981 Italy 567 |
> | 1982 Italy 129 |
> | 1980 France 349 |
> | 1981 France 235 |
> | 1982 France 567 |
> | 1980 Germany 256 |
> | 1981 Germany 980 |
> | 1982 Germany 100 |
> +---------------------------------+
>
>
> On Mon, Oct 13, 2008 at 12:38 PM, sara borelli
> <[email protected]> wrote:
> > Dear Statalist members,
> >
> > I have the following question.
> > I have a dataset of the form:
> >
> > year italy france germany ... ... ...
> > 1980 209 349 256
> > 1981 567 235 980
> > 1982 129 567 100
> > ...
> >
> > where the numerical values indicate some expenditure
> levels. I would like to transfor this dataset into a panel
> creating the new variable "Expenditure", so that
> that dataset look like:
> >
> > expenditure year country
> > 280 1980 italy
> > 567 1981 italy
> > 129 1982 italy
> > 349 1980 france
> > 235 1981 france
> > 567 1982 france
> > 256 1980 germany
> > 980 1981 germany
> > 100 1982 germany
> > .....
> >
> > any idea on how I can do this?
> > thank you in advance for any help
> >
> > Sara Borelli
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
Scopri il blog di Yahoo! Mail:
Trucchi, novità e scrivi la tua opinione.
http://www.ymailblogit.com/blog
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/