Date: Mon, 27 Aug 2007 14:58:10 -0500
Reply-To: Mary <firstname.lastname@example.org>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mary <mlhoward@AVALON.NET>
Subject: Re: How to count in sub-sets of a continuous variable?
Content-Type: text/plain; charset="iso-8859-1"
Is each row a patient visit? There is a group by statement in Proc SQL that you might try; I'm not sure if it will work on these multiple counts
select id, count(*) as count
group by id;
If that doesnt work, you could select the distinct ID's and then select ID's and counts individually like this above, then merge them to your id's one by one.
----- Original Message -----
Sent: Monday, August 27, 2007 10:16 AM
Subject: How to count in sub-sets of a continuous variable?
I have a dataset with multiple rows per ID. Each of the rows has a
unique time stamp. I want to count how many ID's have data within
certain time windows. Here's a code that counts the number of rows in
proc sql ;
title 'N of Patients and Visits during FU by Procedure' ;
select count('CTU-ID'n) label='Total Visits',
count (unique 'CTU-ID'n) label='Total Patients',
sum(Days LE 30) label='Visits within 30 Days',
sum(Days between 31 and 90) label='Visits 31 to 90 Days',
sum(Days between 91 and 180) label='Visits 91 to 180 Days',
sum(Days between 181 and 270) label='Visits 181 to 270 Days',
sum(Days GT 270) label='Visits 270+ Days'
from AFLee.Merged ;
quit ; title ;
How do I make it count not rows, but unique IDs within those windows?