Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert date in order to match another date?

Status
Not open for further replies.

katrina11

Technical User
Apr 30, 2011
108
0
0
Hi Experts,

I really need your help.Proc contents gave me the following:

Variable Type Len Format Informat Label
AdmitDate Num 8 DATETIME22.3 DATETIME22.3 AdmitDate
HospDischDate Num 8


HospDischDate looks like : 1594252800
AdmitDate looks like : 09JUL2010:00:00:00.000

How can I convert HospDischDate in order to look like AdmitDate?

I have to do some calculations as I keep getting
unexpected results. So far I really need to visually compare dates values on each step.

Thank you!

Katrin
 
Hi Katrin

IF you observe the PROC CONTENTS output; you can see that AdmitDate variable has got format datetime22.3 while HospDischDate havent got any format.

But I dont see any reason which would create problem in any kind of calculations.

Suppose you want to get difference between Hospital Admit Date and Hospital Discharge Date; you can use following expression.

no_of_admit_days = intck('DAY', datepart(AdmitDate), datepart(HospDischDate));

It should work absolutely fine.

Any how if you want to see the HospDischDate in same foramt as AdmitDate then you can use following PROC DATASETS CODE.

proc datasets lib= (provide the library name for the dataset here) ;
modify (provide the dataset name here);
format HospDischDate datetime22.3;
quit;

GoodLuck



sasbuddy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top