DATA Step, Macro, Functions and more

can we extract modified date of sas dataset using proc contents

Accepted Solution Solved
Reply
Regular Contributor
Posts: 214
Accepted Solution

can we extract modified date of sas dataset using proc contents

I want to extract modified date of a dataset using proc contents. 

 

Any example or suggestion please


Accepted Solutions
Solution
‎09-28-2017 03:47 AM
Super User
Posts: 10,217

Re: can we extract modified date of sas dataset using proc contents

It is easier to retrieve that from dictionary.tables:

proc sql;
create table test as select * from dictionary.tables where libname='SASHELP' and memname = 'CLASS';
create table test2 as select modate from dictionary.tables where libname='WORK' and memname = 'TEST';
quit;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code

View solution in original post


All Replies
Valued Guide
Posts: 593

Re: can we extract modified date of sas dataset using proc contents

You can get the date of the last modification by writing the Proc Contents output to a data set like so

 

data class;
	set sashelp.class;
run;

proc contents data=class out=contents;
run;

The modification date is then held in a datetime variable called MODATE and you can access the date portion of that with the DATEPART function using data step, proc SQL etc.

Solution
‎09-28-2017 03:47 AM
Super User
Posts: 10,217

Re: can we extract modified date of sas dataset using proc contents

It is easier to retrieve that from dictionary.tables:

proc sql;
create table test as select * from dictionary.tables where libname='SASHELP' and memname = 'CLASS';
create table test2 as select modate from dictionary.tables where libname='WORK' and memname = 'TEST';
quit;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 761 views
  • 1 like
  • 3 in conversation