Hi. I'm having several Stored Procedures that I use to update/create tables that users can correct numbers and add lines. When I create the I just want to make a screen saying that the data set has been updated. I can get when the dataset information as dates, path, observations in the printed output from proc contents. However I have not found a way to get this in a dataset so I can test the date against current clock time and make a nice message saying updated successfully. The out statement only give the variables.
Does anybody have a nice trick for this?
Just to show how this works in practice:
proc sql;
create table class as select * from sashelp.class;
select modate
from dictionary.tables
where libname = 'WORK'
and memname = 'CLASS';
quit;
%let wait=%sysfunc(sleep(1,1));
proc sql;
create table class as select * from sashelp.class;
select modate
from dictionary.tables
where libname = 'WORK'
and memname = 'CLASS';
quit;
Result:
Date Modified ---------------- 06JUN19:10:22:35 Date Modified ---------------- 06JUN19:10:22:36
proc sql noprint;
create table updated as
select *
from dictionary.tables
where libname = 'SASHELP'
and memname = 'CLASS' ;
quit;
Column modate will contain a datetime value showing the date and time the table was modified.
Note remember that libname is always in upper case in dictionary and that memname is in mixed case, you may want to surround both memname and your tablename with the upcase function to ensure a match.
Thanks, works like a dream
Just to show how this works in practice:
proc sql;
create table class as select * from sashelp.class;
select modate
from dictionary.tables
where libname = 'WORK'
and memname = 'CLASS';
quit;
%let wait=%sysfunc(sleep(1,1));
proc sql;
create table class as select * from sashelp.class;
select modate
from dictionary.tables
where libname = 'WORK'
and memname = 'CLASS';
quit;
Result:
Date Modified ---------------- 06JUN19:10:22:35 Date Modified ---------------- 06JUN19:10:22:36
Thanks a million. I did not think about dictonary.tables. Shame on me.
How to get created date/time?
It is also in DICTIONARY.TABLES, right next to MODATE.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.