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

From |
Michael McCulloch <mm@pinestreetfoundation.org> |

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

Subject |
Re: st: RE: AW: creating an ordered month variable over several years |

Date |
Sat, 28 Nov 2009 13:46:57 -0800 |

Thank you Austin,

sc sampled screened noreply m, recast(bar)

*** begin example clear all set seed 1 set obs 1000 gen id=_n gen month=1 + int(12*uniform()) gen year=2008 + int(2*uniform()) gen subject_type=1 + int(3*uniform()) la def lab_subjects 1 "no reply" 2 "screened" 3 "sampled", modify la val subject_type lab_subjects g m=(year-1960)*12+month-1 format m %tmm_CY la var m "Calendar month" levelsof m, loc(vs) foreach v of loc vs { la def m `v' "`:di `:format m' `v''", modify } la val m m * insert Nick Cox's cum freq table

frequency from each group. tabdisp m, cell(freq cumfreq) byhist m, by(subject_type) disc tw(xla(576/599,angle(90) val)) contract m subject_type, z f(one) reshape wide one, j(subject_type) i(m) g noreply=max(0,one1) g screened=max(0,one1)+max(0,one2) g sampled=max(0,one1)+max(0,one2)+max(0,one3)

*** end example Best wishes, Michael McCulloch Pine Street Foundation 124 Pine Street San Anselmo, CA 94960-2674 tel: 415-407-1357 fax: 206-338-2391 * * 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: RE: AW: creating an ordered month variable over several years***From:*"Martin Weiss" <martin.weiss1@gmx.de>

- Prev by Date:
**Re: st: RE: reinstate data after -contract- and -reshape-** - Next by Date:
**RE: st: RE: AW: creating an ordered month variable over several years** - Previous by thread:
**st: reinstate data after -contract- and -reshape-** - Next by thread:
**RE: st: RE: AW: creating an ordered month variable over several years** - Index(es):

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