Statalist


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

st: R: Simple tab needed but multiple records


From   "Carlo Lazzaro" <carlo.lazzaro@tin.it>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: R: Simple tab needed but multiple records
Date   Fri, 5 Oct 2007 23:31:29 +0200

Dear Joseph,

I have tried to simulate what seems to be your problem by dividing x-rays in
three age groups (x_ray_17; x_ray_25; x_ray_over30) and then figuring out
that the same patients may receive (1) or not (0) x_ray procedure in
x_ray_17; x_ray_25; x_ray_over30.

Perhaps -count if and list if - with the appropriate restrictions, (see
below, please) may support you in handling this issue.


-------begin example--------------------------------------------------------
set obs 100
gen id = _n
gen x_ray_17=1 in 1/25
replace x_ray_17=0 in 26/50
replace x_ray_17=0 in 51/75
replace x_ray_17=1 in 76/100
gen x_ray_25 = 1 in 1/30
replace x_ray_25 = 0 in 31/60
replace x_ray_25 = 1 in 61/100
gen x_ray_over30 = 1 in 1/20
replace x_ray_over30 = 0 in 21/50
replace x_ray_over30 = 1 in 51/100
count if  x_ray_17!=0 & x_ray_25!=0 & x_ray_over30!=0
list id  x_ray_17 x_ray_25 x_ray_over30 if x_ray_17!=0 & x_ray_25!=0 &
x_ray_over30!=0
-------end example--------------------------------------------------------

Hope this helps.

Kind Regards,

Carlo


-----Messaggio originale-----
Da: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Per conto di Joseph Wagner
Inviato: venerd́ 5 ottobre 2007 21.16
A: statalist@hsphsun2.harvard.edu
Oggetto: st: Simple tab needed but multiple records
Joseph wrote:

I realize this is going to sound simple and usually I can find my answer 
in the archives for statalist or elsewhere online but I am stumped on 
this one.  I have a dataset of x-ray records with multiple records per 
patient.  The records consist of id, age, and sex and I need to know how 
many persons had an x-ray when they were between the age of 17 and 25 
AND when when they were over 30.  My attempts have been crude and I know 
there has to be a simple yet elegent way to do this.

Thanks for you help.

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