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?
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
What was your answer?
SASHELP.VTABLE has the create/modified date.
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
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
how can i write this in programing ?
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.