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" <[email protected]>
To   "'[email protected]'" <[email protected]>
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:[email protected]]
Sent: Wednesday, September 01, 2004 11:51 AM
To: '[email protected]'
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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index