LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 27 Aug 2007 14:58:10 -0500
Reply-To:     Mary <mlhoward@avalon.net>
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?
Comments: To: Haris <Karovaldas@GMAIL.COM>
Content-Type: text/plain; charset="iso-8859-1"

Haris,

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 from table 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.

-Mary ----- Original Message ----- From: Haris To: SAS-L@LISTSERV.UGA.EDU 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 each time-window.

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?

Thanks.


Back to: Top of message | Previous page | Main SAS-L page