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

From |
"Eva Poen" <eva.poen@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Re: "cond" command |

Date |
Thu, 11 Sep 2008 20:19:41 +0100 |

> sort pension > foreach x in jub inv sob { > by pension: gen `x'_1 = sum(`x'==1) > by pension: gen `x'_0 = sum(`x'==0) > by pension: replace `x'_1 = `x'_1[_N] > by pension: replace `x'_0 = `x'_0[_N] > } The above can of course be shortened by using -egen- egen `x'_1 = total(`x'==1) egen `x'_1 = total(`x'==0) inside the loop. Also, the random number function uniform() has been recently renamed to runiform() in Stata 10.1. uniform() continues to work. Eva * * 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/

**References**:**st: "cond" command***From:*"Leonor Saravia" <lmisaravia@gmail.com>

**st: Re: "cond" command***From:*"Leonor Saravia" <lmisaravia@gmail.com>

**Re: st: Re: "cond" command***From:*"Eva Poen" <eva.poen@gmail.com>

- Prev by Date:
**Re: st: Re: "cond" command** - Next by Date:
**st: regexr: escaping nested quotes within strings** - Previous by thread:
**Re: st: Re: "cond" command** - Next by thread:
**st: RE: Re: "cond" command** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |