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

RE: st: Programming question


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Programming question
Date   Thu, 30 Oct 2003 14:30:24 -0000

Winston's do file starts (omitting stuff which
looks irrelevant or unproblematic)

set obs 200
genlev 5 10  centre
genlev 4 10  strata
set seed 745363
gen rand1=uniform()
gen rand2=uniform()
genlev 2 1 treat
sort centre strata block
* making rand2 constant within each block
quie  by centre strata block: replace rand2=rand2[_n-1] if _n~=1
* sorting blocks in random order and
* sorting treatments randomly within blocks
sort centre strata rand2 rand1
genlev 20 1 pid
genlev 4 10 dose
genlev 4 10 age
genlev 2 20 sex

Even on Winston's guess I am unclear how the numbers
fit together for a dataset of 200.

A secondary question is that if -genlev- involves
some generation of random numbers then the -set seed-
statement belongs earlier.

Two of my earlier suggestions remain in the air.

Winston Banya

> MY GUESS is that genlev 5 10 centre  and genlev 4 10 strata would
mean
> generate (randomly) 5 centres in blocks and four strata in blocks
with each
> block containing 10 people.  The four strata are Males 50-69 years,
Males
> 70+  Females 50-69 and females 70+. Within each stratum there are
equal
> number of treatments (i.e 1 & 2) I do not know who wrote the
program. I only
> inherited it when I got my present job as it was on the computer
that was
> assigned to me.
>
> What I need is a randomly generated list fitting the brief
description above
> but I do not know how to do produce it through writing a program
like the
> one I inherited thus the reason for posting the question on
statlist.

Nick Cox

> Your problem is that your .do file uses a -genlev- command
> which is not part of official Stata, was not published in
> the STB or the SJ, and is not available from SSC or other
> prominent Stata websites. Or at least
> I cannot find -genlev- using either -search- or its superset
> -findit-.
>
> Your options include the following:
>
> * Perhaps -genlev- is lurking somewhere on your machine
> or your system, just not visible to the Stata you are
> running. Get your OS to look for it. If you find it,
> copy it to somewhere along your -adopath-. You are
> looking for a file called genlev.ado.
>
> * It sounds as if -genlev- was written by some present
> or past colleague. Ask the local Stata expert where it came
> from. If you are the local expert, ask a bigger less local
> Stata expert. Or here we are on Statalist, so does anyone
> have a -genlev- on their system, i.e. does
>
> . which genlev
>
> find a file?
>
> * Tell us exactly what -genlev- does, and it's probably
> easy then to write a substitute. Personally I can't
> reconstruct what -genlev- does from the syntax used
> to call it.

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