Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Convert Stock to panel of bilateral difference


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: Convert Stock to panel of bilateral difference
Date   Fri, 15 Oct 2010 00:07:56 -0400

Jonathan Stoeterau <[email protected]>:
For that case,

bys year (country_name): g v2=value-value[1] if _n>1
by year: replace v2=value if _n==1

Also read
http://www.stata-journal.com/sjpdf.html?articlenum=pr0004

On Thu, Oct 14, 2010 at 11:37 PM, Jonathan Stoeterau
<[email protected]> wrote:
> Dear Statalist,
>
> I would like to convert country-specific stocks
> of a certain technology into a panel of bilateral
> differences. Specifically, my data currently has
> the following typical panel pattern:
>
> country_name    year    value
> Albania 1962    400
> Albania 1963    430
> Albania 1964    480
> ...
> Algeria 1962    3200
> Algeria 1963    3250
> Algeria 1964    3300
> ...
> Angola  1962 1200
> Angola  1963 1000
> Angola  1964 1300
>
> and i would like to generate a panel that looks like:
>
> country_name    year    country_name2 value
> Albania 1962  Albania  400    //the original value
> Albania 1962  Algeria  2800  //3200-400
> Albania 1962  Angola  800   //1200-400
> ...
> Albania 1963     Algeria  2820 //3250-430
> Albania 1962  Angola  570  //1000-430
> ...
> ...
>
> I would appreciate any comment or idea.
>
> Jonathan

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index