1 / 6

Techie Tips SAS Dates / Times / Datetimes

Techie Tips SAS Dates / Times / Datetimes. Beverley Lawson, Dalhousie Family Medicine. Dates. regdate (from an excel file) 19990809. reg_date (formated sasdate) 09AUG1999. reg_date = input(put(regdate, 8.), yymmdd8.); format reg_date date9.; run;. Time. Obs regt ime

christoffer
Download Presentation

Techie Tips SAS Dates / Times / Datetimes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Techie TipsSAS Dates / Times / Datetimes Beverley Lawson, Dalhousie Family Medicine SHRUG February 6, 2009

  2. Dates regdate (from an excel file) 19990809 reg_date (formated sasdate) 09AUG1999 reg_date = input(put(regdate, 8.), yymmdd8.); format reg_date date9.; run;

  3. Time Obs regtime 1 1343 2 1015 3 0254 Obs regtimereghour regmin 1 1343 13 43 2 1015 10 15 3 0254 02 54 length reghour $2 regmin $ 2; reghour = substr(regtime, 1,2); regmin = substr(regtime, 3,2);

  4. More time …Next add a semi colon & change to a sastime … length nregtime $5; nregtime = reghour||":"||regmin; run; n_regtime = input(nregtime, time5.); format n_regtime hhmm5.; run; regtimereghourregmin 1343 13 43 1015 10 15 0254 02 54 • n_regtime • 13:43 • 10:15 17:51

  5. SAS datetime reg_date 25JAN1999 07MAR1999 18APR1999 regsasdt = dhms (reg_date, 0, 0, n_regtime); put regsasdt datetime.; format regsasdt datetime.; run; n_regtime 17:51 23:12 22:01 regsasdt 25JAN99:17:51:00 07MAR99:23:12:00 18APR99:22:01:00 +

  6. Wait times(e.g ED visits) wait_rd = disch_sasdt - regsasdt; format wait_rd hhmm5.; label wait_rd = 'ED wait time from registration to discharge'; run; disch_sasdt 25JAN99:21:16:00 08MAR99:04:15:00 19APR99:00:20:00 regsasdt 25JAN99:17:51:00 07MAR99:23:12:00 18APR99:22:01:00 wait_rd 3:25 5:03 2:19 -

More Related