Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: simple sum() question


From   "Josiane Georges" <[email protected]>
To   <[email protected]>
Subject   st: RE: simple sum() question
Date   Wed, 15 Apr 2009 10:58:06 -0400

I use the collapse command when dealing with claims data structure much
the way your clinic visit data is.

I would suggest the following syntax:

collapse (sum) clinic, by (patient_id)

Josiane "Josie" Georges
Sr. Planning Analyst
Division of Mental Hygiene
Tel: 212-219-5194
Fax: 212-219-5192
Email: [email protected]

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Shehzad Ali
Sent: Wednesday, April 15, 2009 10:48 AM
To: [email protected]
Cc: [email protected]
Subject: st: simple sum() question

Hi,

I have a simple question about summing across observations. I have 100 
patients (variable: patient_id) in the dataset, each had clinic visits 
(variable: clinic) and hospital visits (variable: hospital) recorded at 
weeks 4, 8, 12 and 16. The dataset is long and hence I have 400 
observations (one observation per patient per time point).

I want to sum the clinic visits for each patient (across all 4 visits) 
bearing in mind that some patients had less than 4 visits. So
effectively I 
want to generate a new variable that will produce the sum of clinic
visits 
for each patient.

Any help would be appreciated.

Thank you,
Shehzad
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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