Statalist The Stata Listserver


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

Re: st: Re: programming assist, too many unique values for levels


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   Re: st: Re: programming assist, too many unique values for levels
Date   Tue, 01 May 2007 16:32:38 -0400

..
Woops, there's a mistake in one line:

gen bphigh=bp_systolic >= `threshold' & bp_systolic !=.

should be

gen bphigh=bp_systolic >= `threshold' if bp_systolic !=.

This change will cause it to have missing values when bp is missing, which will give the correct proportion (assuming you don't want to count missing values in the denominator)

Michael

----- Original Message ----- From: "Andrew O'Connor DO" <[email protected]>
To: <[email protected]>
Sent: Tuesday, May 01, 2007 4:25 PM
Subject: Re: st: Re: programming assist, too many unique values for levels



thank you
Andrew O'Connor, DO, MPH
Division of Nephrology
Center for Healthcare Research and Policy
MetroHealth Medical Center/Case Western Reserve University
(216)778-8484
[email protected] 05/01/07 4:19 PM >>>
You don't need the levels command or the loops at the end, just use
-egen-
commands:

egen time=sum(obstime), by(pt)
egen time_out=sum(out_range), by(pt)
gen bphigh=bp_systolic >= `threshold' & bp_systolic !=.
egen proportion=mean(bphigh), by(pt)
<snip>
*
* 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