Statalist The Stata Listserver


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

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


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Like %GL(r,n) in GLIM
Date   Tue, 27 Feb 2007 18:18:44 -0000

Right in sprit, but 

First example is wrong. 

Second example starts 0,0,0,0. 

Nick 
n.j.cox@durham.ac.uk 

Newson, Roger B
 
> I think what you are looking for is a combination of the 
> system variable
> _n (order of observation in a dataset) and the -mod()-, -int()-,
> -floor()- and -ceil()- functions. For on-line help for functions in
> Stata, type in Stata
> 
> whelp functions
> 
> Your first example can be created, as the variable -fact1-, by typing
> 
> gene fact1=mod(_n,4)+1
> 
> and your second example can be created, as the variable -fact2-, by
> typing
> 
> gene fact2=int((_n-1)/4)

*
*   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