BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
smm662002
Quartz | Level 8

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

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
}

View solution in original post

5 REPLIES 5
SASJedi
SAS Super FREQ

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?

 

Check out my Jedi SAS Tricks for SAS Users
BrunoMueller
SAS Super FREQ

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;
smm662002
Quartz | Level 8

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

 

BrunoMueller
SAS Super FREQ

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
}
smm662002
Quartz | Level 8

Hi,

 

Thank you so much.

It works great.

 

Regards,

smm662002

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 639 views
  • 6 likes
  • 3 in conversation