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

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


From   "John" <[email protected]>
To   [email protected]
Subject   Re: st: RE: egen fill() for string variables?
Date   Wed, 01 Sep 2004 17:21:09 -0000

Thanks Austin - from your addition of the .gen obs and .sort obs
lines you're implying that the expansion needs to be put in the
correct structure (all four replicates of the observation need to be
grouped sequentially) so the fill works correctly?
-JW

--- In [email protected], "Nichols, Austin" <ANichols@u...>
wrote:
> 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@a...]
> Sent: Wednesday, September 01, 2004 11:51 AM
> To: 'statalist@h...'
> 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