Statalist


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

Re: st: Fixing the value in egen command


From   Tanveer Shehzad <C.T.Shehzad@rug.nl>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Fixing the value in egen command
Date   Thu, 12 Feb 2009 10:03:21 +0100

Thanks Nick and Maartin:

Both solutions work fine.

Best regards,

Tanveer


Nick Cox wrote:
> gen bad = missing(assets) 
> bysort bank (bad year) : gen first = assets[1] 
>
> Alternatively, a -first()- -egen- function is included in -egenmore- on
> SSC that gives first non-missing values. 
>
> It's better to learn the logic behind the code above. Within banks, sort
> all the missing values to the end and within blocks of non-missing and
> missing, sort by year.  
>
> Nick 
> n.j.cox@durham.ac.uk 
>
> Tanveer Shehzad
>
> <edited> 
>
> I have something like 10,000 banks and I need to
> take their initial level of assets (the first available value and not
> corresponding to a fixed year). Could there be any solution?
>
> *
> *   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/
>   


-- 
Choudhry Tanveer Shehzad (Tanveer)
PhD Student
Department of Finance,
Faculty of Economics & Business,
University of Groningen,
Nettelbosje 2 
9747 AE Groningen 
The Netherlands
Mobile: 0031-644801970
Home Page: http://www.rug.nl/staff/c.t.shehzad/

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