Thanks all, and some clever solutions, too.
I know that back in the day, Stata had not had such a function, and as
Nick's original e-mail suggests, someone probably wrote one up --egen
seq()- for one of us GLIM aficianados!
As I said previously, I was having the hardest time trying to think of a
good keyword to search on...
Best,
--Herb
Professor of Sociology and
Director, Population Studies Center
230 McNeil Building
3718 Locust Walk CR
University of Pennsylvania
Philadelphia, PA 19104-6298
[email protected]
215.898.7768 (office)
215.898.2124 (fax)
On Tue, 27 Feb 2007, Nick Cox wrote:
> -egen, seq()- exists because someone wanted the
> same thing, a while back.
>
> If it didn't exist, both your examples are obtainable
> by using functions and _n
>
> . clear
>
> . set obs 16
>
> . gen block = ceil(_n / 4)
>
> . gen cycle = 1 + mod(_n-1, 4)
>
> . list
>
>
> Nick
> [email protected]
>
> Herb Smith
>
> > Sorry! Just found seq( ) within -egen- ; hadn't been able to
> > think of the
> > right keywords, but belatedly realized it must be an -egen- sort of
> > command...
>
> > On Tue, 27 Feb 2007, Herb Smith wrote:
> >
> > > Sorry for the "insider" nature of this post.... But if
> > there are any of
> > > you out there who remember running log-linear models under the GLIM
> > > program, you will remember a nifty function for creating
> > "factors" for
> > > contingency tables. The command
> > >
> > > CALC newfac = %GL(r,n)
> > >
> > > would create a variable (if I recall correctly) of 1,...,r
> > in blocks of n
> > >
> > > This meant that to input a high-dimensional (or any dimensional)
> > > contingency table, one needed to only input the counts.
> > The structure of
> > > the table (R x C, or R x C x G, etc.) could be accomplished
> > quickly by the
> > > %GL command.
> > >
> > > So, in brief, I am looking for a command that creates a
> > variable like:
> > >
> > > 1
> > > 2
> > > 3
> > > 4
> > > 1
> > > 2
> > > 3
> > > 4
> > >
> > > and another like
> > >
> > > 1
> > > 1
> > > 1
> > > 1
> > > 2
> > > 2
> > > 2
> > > 2
> > >
> > > and so on.
> > >
> > > If no %GL like command exists, fine; I'm sure I can figure
> > out a short way
> > > to program this; but if such a command does exist, it would
> > be good to
> > > know.
>
> *
> * 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/
>
*
* 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/