Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Like %GL(r,n) in GLIM


From   SamL <saml@demog.berkeley.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Like %GL(r,n) in GLIM
Date   Tue, 27 Feb 2007 10:14:43 -0800 (PST)

You can use the fill function in -egen-.  So, say you have a 4*4 table of
counts.

egen col=fill(1 2 3 4 1 2 3 4)

will make the columns, and

egen row=fill(1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4)

would make the rows.  I've never used -seq- so it may be better.

HTH
Sam

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.
>
> Thanks,
>
> --Herb
>
> Professor of Sociology and
> Director, Population Studies Center
> 230 McNeil Building
> 3718 Locust Walk CR
> University of Pennsylvania
> Philadelphia, PA  19104-6298
>
> hsmith@pop.upenn.edu
>
> 215.898.7768 (office)
> 215.898.2124 (fax)
> *
> *   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/



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