[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: more complicated counting...
A small detail, but one that has arisen in various other
postings recently, to my surprise.
On Statalist, we are sensitive to the rules of English,
whatever they are, but where there is a clash the rules
of Stata take absolute precedence.
Thus, never write things like
Gen keepers = 0
That is just illegal Stata, as "Gen" is not a legal Stata
command. A reference to it would probably fool
very few readers, but nevertheless always write things like
gen keepers = 0
> Thanks for your response. You'll have to forgive my using
> illegal names
> for variables. I am new to stata and did not realize that
> such a beast
> existed. The variable names I used in my email are different
> than in my
> dataset, as I was trying to impart more information for the listserv.
> Apparently that backfired!
> I'll try to clarify my question: Patients are operated on by
> a surgeon,
> a surgeon may operate at more than one hospital. If a
> surgeon operates
> at more than one hospital I want to keep the patients from
> the hospital
> where the surgeon did the most cases (to preserve as much
> sample size as
> From your response and my own trial and error I came up with the
> following solution:
> Gen keepers=0
> gsort surg -cases
> by surg: replace keep=1 if hospid[_n]!=hospid
> This worked in my dataset beautifully.
> Thanks for the tips on user-written contributions.
* For searches and help try: