BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
darling143
Fluorite | Level 6

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?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
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

8 REPLIES 8
Reeza
Super User

What was your answer?

LinusH
Tourmaline | Level 20
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
LinusH
Tourmaline | Level 20
Sorry, I blame autocorrect.
SASHELP.VMEMBER it should read...
Data never sleeps
Reeza
Super User

SASHELP.VTABLE has the create/modified date.

 

 

Ksharp
Super User
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





JohnHoughton
Quartz | Level 8

 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

darling143
Fluorite | Level 6

how can i write this in programing ?

 

Cynthia_sas
SAS Super FREQ

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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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