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]

From |
Nick Cox <njcoxstata@gmail.com> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: loop |

Date |
Mon, 27 Aug 2012 08:46:11 +0100 |

forval j = 1/12 { su newcat12'j', meanonly .... = ln(r(sum)) } where ... is the assignment to scalar or variable Chiara wants.

(For ' read left single quote above when appropriate.) Nick On 27 Aug 2012, at 08:22, Muhammad Anees <anees@aneconomist.com> wrote:

tab cat12, gen(newcat12) will give you those required variables (categorical or dummies). HTH AneesOn Mon, Aug 27, 2012 at 11:32 AM, Chiara Mussida<cmussida@gmail.com> wrote:Dear all, the variable cat12 takes the values from 1 to 12. I want to create 12 different scalars or variables for each cat. The problem is that each scalar must take the values correspondent to the log of the number of obs in each cat (weighted) since i have to write an index which needs those numbers. I tried with forvalues but i did not succeed!Ps: cat12 is a variable for occupational categories (from 1 to 12).Inthe index i put the weighted values (weight available in my dataset).

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

**Follow-Ups**:**Re: st: loop***From:*Chiara Mussida <cmussida@gmail.com>

**References**:**st: loop***From:*Chiara Mussida <cmussida@gmail.com>

**Re: st: loop***From:*Muhammad Anees <anees@aneconomist.com>

- Prev by Date:
**Re: st: loop** - Next by Date:
**st: subgroup analysis in the DCE model** - Previous by thread:
**Re: st: loop** - Next by thread:
**Re: st: loop** - Index(es):