Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: egen fill() for string variables?


From   "Nichols, Austin" <ANichols@ui.urban.org>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: egen fill() for string variables?
Date   Wed, 1 Sep 2004 12:18:50 -0400

I think you can get the desired result with a slight modification:
. gen long obs=_n
. expand 4
. sort obs
. egen animal = fill(1,2,3,4,1,2,3,4)
. label define critter 1 "cat" 2 "dog" 3 "rat" 4 "fish"
. label value animal critter
. decode animal, gen(str_animal) 
-----Original Message-----
From: Wallace, John [mailto:John_Wallace@affymetrix.com]
Sent: Wednesday, September 01, 2004 11:51 AM
To: 'statalist@hsphsun2.harvard.edu'
Subject: st: egen fill() for string variables?
would a workaround such as the following work? 
. expand 4
. egen animal = fill(1,2,3,4,1,2,3,4)
. label define critter 1 "cat" 2 "dog" 3 "rat" 4 "fish"
. label value animal critter
. decode animal, gen(str_animal) 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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