As always, I am full of admiration and gratitude! Thanks!
/Jan
----- Original Message -----
From: "Nick Cox" <[email protected]>
To: <[email protected]>
Sent: Thursday, April 01, 2004 9:29 PM
Subject: st: RE: Presenting a country-period table
> The result of this
>
> egen When = concat(periodstart periodend), p("-")
> gen when = ""
> bysort country (When) : replace when = when[_n-1] + When + "," if _n < _N
> by country : replace when = when[_n-1] + When if _n == _N
> by country : gen last = _n == _N
> list country when if last, noobs sep(0)
>
> is this
>
> +-----------------------------------------------------+
> | country when |
> |-----------------------------------------------------|
> | Argentina 1986-1989,1990-1993,1994-1997,1998-2001 |
> | Bolivia 1986-1989,1990-1993,1994-1997,1998-2001 |
> | Botswana 1974-1977,1978-1981,1982-1985 |
> +-----------------------------------------------------+
>
> You can also left-justify via -format-. Any use?
>
> Nick
> [email protected]
>
> Jan Pettersson
>
> > I have a list of the following form:
> >
> > country periodstart periodend
> > Argentina 1986 1989
> > Argentina 1990 1993
> > Argentina 1994 1997
> > Argentina 1998 2001
> > Bolivia 1986 1989
> > Bolivia 1990 1993
> > Bolivia 1994 1997
> > Bolivia 1998 2001
> > Botswana 1974 1977
> > Botswana 1978 1981
> > Botswana 1982 1985
> > etc.
> >
> > that I would like to present in a table looking like:
> >
> > Argentina (1986 - 1989, 1990 - 1993, 1994 - 1997, 1998 - 2001);
> > Bolivia (1986 - 1989, 1990 - 1993, 1994 - 1997, 1998 - 2001);
> > Botswana (1974 - 1977, 1978 - 1981, 1982 - 1985);
> > etc.
> >
>
> *
> * 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/