Skip to main content

Posts

Showing posts from April, 2016

SAS code to get all the table name under the library

Issue: SAS Admins were usually asked how many libraries do we have? What are the tables under the library? Here is the code to get all the table name under the library. Solution: Say I have a library named as Oracle Scoring and its libref is orascore then my code will be PROC SQL;      SELECT *      FROM sashelp.vmember      WHERE libname = " orascore  "   ; QUIT; In above code you need to just replace orascore with the libref of your library in your environment.  If you want to search for the table with specific pattern then you can use below code PROC SQL;      SELECT *      FROM sashelp.vmember      WHERE libname = " orascore  " and memname like " pattern "   ; QUIT;

Which license should I apply if I have more that one?

Issue: Our SAS environment license was about to expire. We ordered SAS License from SAS. They provided with two license for server with similar products. We are confused with which license to apply in our environment. Solution: Whenever we get license from SAS, it is always overwhelming. Because they provide license for Windows (SAS Clients) and Linux (SAS Server). You receive almost 8 to 10 text files including the renewal instructions. The easy way to figure out which license to apply for our environment is site number. Yes, don't get deviated by product name which will be misleading. In our environment we used to apply the license named as pre-production in prod. So it is not the recommended to apply license based on SITEINFO NAME. Always apply license based on the SITE= number. Run PROC SETINIT; RUN; in your server. You will get the site number. See which license have the same license number provided by SAS Tech Support. Apply that license in your environment to avoid a...

SAS code to find whether library is preassigned or not

Issue: How to find whether the library is pre-assigned or not? Solution: I got the below code from SAS Tech support. It will show all library names, engine, path and pre-assigned details. data metadata_libraries;   length liburi upasnuri $256 name $128 type id $17     libref engine $8 path mdschemaname schema $256     preassign $ 1 mdCreated mdUpdated $ 18;   keep name libref engine path mdschemaname schema preassign mdCreated mdUpdated;   call missing(liburi,upasnuri,name,engine,libref,preassign,mdCreated,mdUpdated);   /* Get each Library object */   nlibobj=1;   librc=metadata_getnobj("omsobj:SASLibrary?@Id contains '.'",nlibobj,liburi);   /* For each library, retrieve the libref, engine, path */   do while (librc>0);      /* Get Library attributes */      rc=metadata_getattr(liburi,'Name',name);      rc=metadata_ge...