SAS Data Management

SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop, SAS Data Preparation and others
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
PaalNavestad
Pyrite | Level 9

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? 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

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

View solution in original post

6 REPLIES 6
MichaelLarsen
SAS Employee
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.

Kurt_Bremser
Super User

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
PaalNavestad
Pyrite | Level 9

Thanks a million. I did not think about dictonary.tables. Shame on me. 

pdhokriya
Pyrite | Level 9

How to get created date/time?

 

pdhokriya_0-1623734138036.png

 

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to connect to databases in SAS Viya

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.

Discussion stats
  • 6 replies
  • 6226 views
  • 1 like
  • 4 in conversation