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 (June 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 8 Jun 2009 09:52:06 -0400
Reply-To:     Akshaya <akshaya.nathilvar@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Akshaya <akshaya.nathilvar@GMAIL.COM>
Subject:      Re: Coding for Date Calculation
Comments: To: "Lowe, Timothy J" <>
In-Reply-To:  <>
Content-Type: text/plain; charset=ISO-8859-1

I'm not sure how variable for each day would help, for example if a patient had a hospital stay for 6 months, 360+ variables in the final datafile. Data have; input (ad_dt ds_dt) (:mmddyy10.); format _numeric_ mmddyy10.; cards; 01/01/2009 01/05/2009 02/01/2009 02/03/2009 03/01/2009 03/31/2009 ;

Proc sql noprint; select max(range(ad_dt,ds_dt)+1) into :max from have; Quit;

%put &max;

Data want;

set have; array col{&max}; array freq{&max};

do _i=ad_dt to ds_dt; _j=sum(_j,1); freq[_j]=_j; col[_j]=_i; end;

format col: mmddyy10.; drop _:;


On Mon, Jun 8, 2009 at 8:57 AM, Lowe, Timothy J <> wrote:

> I have a tricky one to do. I have a list of hospital patients with their > admission date and discharge date. I want to calculate their length of stay > using a rather complex formula requiring calculating their length of stay > each day they are in the hospital. What it looks like is this and I assume I > need a multi array to do it -- but am having a hard time figuring it out. > > Admission_date Discharge_date col1 col2 col3 > col4 col5 > 01/01/2009 01/05/2009 01/01/2009 01/02/2009 > 01/03/2009 01/04/2009 01/05/2009 > > > > freq1 freq2 freq3 freq4 freq5 > 1 2 3 4 5 > > > > Any ideas? > > Thanks. > > Tim > > ----------------------------------------- > This electronic message may contain information that is > confidential and/or legally privileged. It is intended only for the > use of the individual(s) and entity named as recipients in the > message. If you are not an intended recipient of this message, > please notify the sender immediately and delete the material from > any computer. Do not deliver, distribute or copy this message, and > do not disclose its contents or take any action in reliance on the > information it contains. Thank you. >

-- AkshayA!

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