DATA Step, Macro, Functions and more

SAS Libraries

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

SAS Libraries

hi

when i was attended interview they asked me

HOW CAN YOU GET LATEST DATASET FROM SAS LIBRARIES ?

I AM NEW TO SAS PLEASE LET ME KNOW AND EXPLAIN IT?

 


Accepted Solutions
Solution
‎07-30-2016 05:40 AM
Super User
Posts: 10,020

Re: SAS Libraries

Posted in reply to darling143
It is more like a OS Admin question.
But you can query DICTIONARY TABLE to get it . There is a variable name MODIFIED DATE :


proc sql;
select * 
 from dictionary.tables
  where libname='SASHELP';
quit;



Library Name	Member Name	Member Type	DBMS Member Type	Data Set Label	Data Set Type	Date Created	Date Modified	Number of Physical Observations	Observation Length	Number of Variables	Type of Password Protection	Compression Routine	Encryption	Number of Pages	Size of File	Percent Compression	Reuse Space	Bufsize	Number of Deleted Observations	Number of Logical Observations	Longest variable name	Longest label	Maximum number of generations	Generation number	Data Set Attributes	Type of Indexes	Data Representation	Name of Collating Sequence	Sorting Type	Charset Sorted By	Requirements Vector	Data Representation Name	Data Encoding	Audit Trail Active?	Audit Before Image?	Audit Admin Image?	Audit Error Image?	Audit Data Image?	Number of Character Variables	Number of Numeric Variables
SASHELP	AACOMP	DATA	 	 	DATA	18JUN15:06:23:43	18JUN15:06:23:43	2020	1269	4	---	CHAR	NO	6	458752	85	no	65536	0	2020	6	0	0	.	ON	COMPOSITE	NATIVE	 	SK	ANSI	181F101133220033330102310133012333001C0000200301	SOLARIS_X86_64, LINUX_X86_64, ALPHA_TRU64, LINUX_IA64	us-ascii ASCII (ANSI)	no	no	no	no	no	3	1
SASHELP	AARFM	DATA	 	 	DATA	28MAY15:08:58:48	28MAY15:08:58:48	61	1269	4	---	CHAR	NO	3	262144	0	no	65536	0	61	6	0	0	.	ON	COMPOSITE	NATIVE	 	SK	ANSI	181F101133220033330102310133012333001C0000200301	SOLARIS_X86_64, LINUX_X86_64, ALPHA_TRU64, LINUX_IA64	us-ascii ASCII (ANSI)	no	no	no	no	no	3	1





View solution in original post


All Replies
Super User
Posts: 19,772

Re: SAS Libraries

Posted in reply to darling143

What was your answer?

Super User
Posts: 5,424

Re: SAS Libraries

Posted in reply to darling143
SAS data set files have a last modified date (like any other OS file).
This information is available through SAS file Metadata, and accessible through various ways, like PROC CONTENTS, data step SAS file functions and also through the automatic data dictionary SASHELP.CLASS-STORA.VMEMBER.
Explore these alternatives, an excellent way to learn SAS and managing SAS files.
Data never sleeps
Super User
Posts: 5,424

Re: SAS Libraries

Posted in reply to darling143
Sorry, I blame autocorrect.
SASHELP.VMEMBER it should read...
Data never sleeps
Super User
Posts: 19,772

Re: SAS Libraries

SASHELP.VTABLE has the create/modified date.

 

 

Solution
‎07-30-2016 05:40 AM
Super User
Posts: 10,020

Re: SAS Libraries

Posted in reply to darling143
It is more like a OS Admin question.
But you can query DICTIONARY TABLE to get it . There is a variable name MODIFIED DATE :


proc sql;
select * 
 from dictionary.tables
  where libname='SASHELP';
quit;



Library Name	Member Name	Member Type	DBMS Member Type	Data Set Label	Data Set Type	Date Created	Date Modified	Number of Physical Observations	Observation Length	Number of Variables	Type of Password Protection	Compression Routine	Encryption	Number of Pages	Size of File	Percent Compression	Reuse Space	Bufsize	Number of Deleted Observations	Number of Logical Observations	Longest variable name	Longest label	Maximum number of generations	Generation number	Data Set Attributes	Type of Indexes	Data Representation	Name of Collating Sequence	Sorting Type	Charset Sorted By	Requirements Vector	Data Representation Name	Data Encoding	Audit Trail Active?	Audit Before Image?	Audit Admin Image?	Audit Error Image?	Audit Data Image?	Number of Character Variables	Number of Numeric Variables
SASHELP	AACOMP	DATA	 	 	DATA	18JUN15:06:23:43	18JUN15:06:23:43	2020	1269	4	---	CHAR	NO	6	458752	85	no	65536	0	2020	6	0	0	.	ON	COMPOSITE	NATIVE	 	SK	ANSI	181F101133220033330102310133012333001C0000200301	SOLARIS_X86_64, LINUX_X86_64, ALPHA_TRU64, LINUX_IA64	us-ascii ASCII (ANSI)	no	no	no	no	no	3	1
SASHELP	AARFM	DATA	 	 	DATA	28MAY15:08:58:48	28MAY15:08:58:48	61	1269	4	---	CHAR	NO	3	262144	0	no	65536	0	61	6	0	0	.	ON	COMPOSITE	NATIVE	 	SK	ANSI	181F101133220033330102310133012333001C0000200301	SOLARIS_X86_64, LINUX_X86_64, ALPHA_TRU64, LINUX_IA64	us-ascii ASCII (ANSI)	no	no	no	no	no	3	1





Contributor
Posts: 41

Re: SAS Libraries

Posted in reply to darling143

 Hi,

Could the interviewer have been looking for one of the automatic macro variables, SYSLAST or SYSDSN, both of which have details of the most recently created SAS data set

New Contributor
Posts: 4

Re: SAS Libraries

Posted in reply to JohnHoughton

how can i write this in programing ?

 

SAS Super FREQ
Posts: 8,864

Re: SAS Libraries

[ Edited ]
Posted in reply to darling143

Hi:
We have an example of using %PUT with the automatic Macro variables in our Programming 2 class. To learn about the automatic macro variables, here's the documentation site:
http://support.sas.com/documentation/cdl/en/mcrolref/67912/HTML/default/viewer.htm#n18mk1d0g1j31in1q...

Your original question is nearly impossible to answer:
"How can you get latest dataset from SAS libraries?" -- because too much is unknown? For what purpose? Just a list of the latest dataset? To use the latest dataset in a subsequent program? What, exactly do they mean by the "latest" dataset? The last dataset created? The last dataset modified? The last dataset deleted? What do you mean by the word "get" -- "get the name", "get the data"? My tendency is to think that they were looking for &SYSLAST, which would show an understanding of at least Programming 1 and Programming 2 level concepts and skills. But,, it is nearly impossible to explain how you can write "this" in programming since the "this" you want has so many unknowns.

cynthia

☑ This topic is solved.

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

Discussion stats
  • 8 replies
  • 439 views
  • 7 likes
  • 6 in conversation