Prev: Help needed to Concatenate variables in SAS Dataset into a new variable
Next: how to export only few variables using proc export
From: Kenneth M. Lin on 31 Mar 2010 23:30 Okay, so I have two variables, one date and one time, both are in SAS dataset. Why is it that SAS doesn't have a function to combine them together to create a datetime variable? I could apply put function to each field, concatenate them, then input using datetime format. I could also multiply the date variable by 60 * 60 * 24 and add the time variable into it since SAS stores dates and times as numeric fields.
From: Barry Schwarz on 1 Apr 2010 00:26 Doesn't your reference describe the DHMS function? dt = dhms(d,,,t); On Wed, 31 Mar 2010 20:30:51 -0700, "Kenneth M. Lin" <kenneth_m_lin(a)sbcglobal.net> wrote: >Okay, so I have two variables, one date and one time, both are in SAS >dataset. Why is it that SAS doesn't have a function to combine them >together to create a datetime variable? I could apply put function to each >field, concatenate them, then input using datetime format. I could also >multiply the date variable by 60 * 60 * 24 and add the time variable into it >since SAS stores dates and times as numeric fields. -- Remove del for email
From: a on 1 Apr 2010 07:41
On Mar 31, 11:26 pm, Barry Schwarz <schwa...(a)dqel.com> wrote: > Doesn't your reference describe the DHMS function? > dt = dhms(d,,,t); > ERROR 159-185: Null parameters for DHMS are invalid 169 data test; 170 date = today(); 171 time = time(); 172 dt = dhms(date,0,0,time); 173 put dt=datetime.; 174 run; dt=01APR10:06:40:21 |