Hello,
SAS VIYA - 2023.03
I have created an automation process using CAS action but the time reported by CAS action table.tableInfo in "CreateTime" is two hours earlier than the system time.
For example the value in Created should have been 2024-06-05T12:40:19+00:00 but it is 2024-06-05T10:40:19+00:00.
Has anyone had this issue?
Thank you.
smm662002
Thank you,
smm662002
When you change your code to this, adapted to your names used
proc cas;
action table.tableInfo result=r2 /caslib="CASUSER", name="myClass";
do row over r2.tableinfo;
print(note) row;
end;
run;
quit;
You will find that you get the following dictionary back. Note you have formatted values that take the timezone into consideration and unformatted values that are the UTC values. You are using the UTC values.
{ Name=MYCLASS, Rows=19, Columns=5, IndexedColumns=0, Encoding=utf-8, CreateTimeFormatted=2024-06-06T17:45:28+02:00, ModTimeFormatted=2024-06-06T17:45:28+02:00, AccessTimeFormatted=2024-06-06T17:45:28+02:00, JavaCharSet=UTF8, CreateTime=2033307928.2, ModTime=2033307928.2, AccessTime=2033307928.2, Global=0, Repeated=0, View=0, MultiPart=0, SourceName=, SourceCaslib=, Compressed=0, Creator=someuser, Modifier=, SourceModTimeFormatted=, SourceModTime=., TableRedistUpPolicy=Not Specified }
The SAS Compute Server and CAS server usually run on separate machines. Is it possible that the system time on the SAS compute server differs from the system time on the CAS server?
You can adjust the timezone information when creating a CAS session, see here for more information https://go.documentation.sas.com/doc/en/pgmsascdc/v_049/casref/n02215l0eb3lxtn13piutithjc32.htm
Have look at the code below, there are two CAS statements, use only one of them. One sets the timezone to the same value as in your SAS session, the other goes with the default. Have a look at the results of the table.tableinfo action for the difference.
%let timeZone = %sysfunc(getoption(timezone));
%put NOTE: &=timezone;
cas sugus sessopts=(caslib="casuser" timezone=&timeZone);
* cas sugus sessopts=(caslib="casuser");
data myclass;
set sashelp.class;
run;
proc casutil;
load data=myclass casout="myclass" replace;
run;
quit;
proc cas;
action table.tableinfo / caslib="casuser";
run;
quit;
cas sugus terminate;
Hi Bruno,
Thank you so much for the codes using timezone. The CAS session was assigned using
timezone=&timeZone
But this solution only solve part of the issue (yesterday the results from point 1 below were also wrong)
1. when I am using the code below the result is correct ( "Created" value is "2024-06-06T15:41:28+02:00")
proc cas;
table.tableInfo /caslib="CASUSER", name="mytable";
quit;
2. when I'm using the code below the result is still two hours earlier (the macro var &create_dtm_txt resolve to 06JUN24:13:41:28)
proc cas;
table.tableInfo result=r2 /caslib="CASUSER", name="myTable";
create_dtm=r2.tableInfo[,"CreateTime"][1];
call symputx('create_dtm', create_dtm, 'G');
quit;
%put &=create_dtm;
%let create_dtm_txt=%sysfunc(putn(&create_dtm.,datetime.));
%put create_dtm_txt=&create_dtm_txt.;
&create_dtm= 2033300487.9.
Thank you,
smm662002
When you change your code to this, adapted to your names used
proc cas;
action table.tableInfo result=r2 /caslib="CASUSER", name="myClass";
do row over r2.tableinfo;
print(note) row;
end;
run;
quit;
You will find that you get the following dictionary back. Note you have formatted values that take the timezone into consideration and unformatted values that are the UTC values. You are using the UTC values.
{ Name=MYCLASS, Rows=19, Columns=5, IndexedColumns=0, Encoding=utf-8, CreateTimeFormatted=2024-06-06T17:45:28+02:00, ModTimeFormatted=2024-06-06T17:45:28+02:00, AccessTimeFormatted=2024-06-06T17:45:28+02:00, JavaCharSet=UTF8, CreateTime=2033307928.2, ModTime=2033307928.2, AccessTime=2033307928.2, Global=0, Repeated=0, View=0, MultiPart=0, SourceName=, SourceCaslib=, Compressed=0, Creator=someuser, Modifier=, SourceModTimeFormatted=, SourceModTime=., TableRedistUpPolicy=Not Specified }
Hi,
Thank you so much.
It works great.
Regards,
smm662002
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.