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

st: R: Simple tab needed but multiple records

From   "Carlo Lazzaro" <>
To   <>
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 &
-------end example--------------------------------------------------------

Hope this helps.

Kind Regards,


-----Messaggio originale-----
[] Per conto di Joseph Wagner
Inviato: venerd́ 5 ottobre 2007 21.16
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:

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index