Hi
Iam having date valus as "25JAN2019:13:30:59.590000" in one of the SAS dataset.
and iam using timepart(25JAN2019:13:30:59.590000) function and format and informat as tim8.
Iam getting below time value
13:31:38
Iam unable to understand why 59 is getting changed to 38 please.please help how it reallly works
Please post your entire code. This works fine
data _null_;
dt="25JAN2019:13:30:59.590000"dt;
t=timepart(dt);
put dt= // t= time8.;
run;
Hi @PeterClemmensen ,
the function is used in SAS DI in table loader transformation with timepart() and informat and format as "TIME8.".
so i just wanted to know how timepart(25JAN2019:13:30:59.590000) is giving result as below for fomar and informat time8.is this correct please.iam trying to under stand how 13:31:38 is getting created from above date
13:31:38
The TIMEPART() function is NOT the issue.
Look for the answer somewhere else.
Are you sure about the original value.
How did you convert that string into a datetime value.
Did you perhaps store it into a SAS variable that used less than the full 8 bytes to store the value? That can cause some loss of precision on numbers. The number of seconds that are stored for that datetime value is: 1,864,042,259.590000
@JJP1 wrote:
Hi
Iam having date valus as "25JAN2019:13:30:59.590000" in one of the SAS dataset.
and iam using timepart(25JAN2019:13:30:59.590000) function and format and informat as tim8.
Iam getting below time value
13:31:38
Iam unable to understand why 59 is getting changed to 38 please.please help how it reallly works
I would expect to see a 13:31:00 if some rounding went on but strongly suspect some other manipulation to get 38 seconds.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.