1

I have been trying to understand how SAS libraries/Folders are stored at physical location. I am trying to understand the concept at administration level.

To explain my confusion more, I would like to go step by step -

(1) The SAS code is run at client. Any variable/library/dataset has definition at metadata Tier that means metadata tier contains logical address which point to physical address and which we can find on compute tier and Compute Tier is on Linux System. How can I find the mapping between logical and physical address. or How can I trace the variable/library/dataset in SAS Management Console or Linux.

(2) SAS Client -> SAS Server -> Database. so when we access any table from database, it is first transformed into SAS table. If I am right about this logic then there should be some physical location where these SAS tables are kept. How can I locate these physical location on Compute Tier.

(3) If I, as a user, create a SAS dataset then what format is it being saved and where? Does it get saved as a flat file on Linux or as a table in some database?

(4) I went through this question and one more confusion got arisen

Proc SQL: How / When does SAS Move the Data

When any data table is loaded from database server to SAS server. Does it reside there for the entire session like or every time when the table is called, the database is to be hit.

I might be wrong with the understanding I have with SAS so please correct me wherever possible.

Thanks

Community
  • 1
  • 1
  • These are probably valid SO questions, with the exception that you have too many at once. I would recommend you ask some of the more detailed ones at communities.sas.com since SAS staff and developers are there and there aren't too many adminstrators on here. – Reeza Jun 30 '16 at 05:22

2 Answers2

0

Regarding Q2&3) Yes and no regarding database being converted. When you read a database, depending on your query, SAS will either pass the query to the DB and then bring the results down to SAS. If the results are a table, then it depends on where the user has specified it to be saved. For linkage with Q3, lets assume it goes to the WORK library. This is sort of the scratch/temp space on a server, but within SAS. It exists for the SAS session and when the session is closed, it's cleared. Datasets in the WORK folder are stored in a proprietary SAS format, SAS7BDAT. The work library is essentially a folder in a directory, not in a database.

If the query cannot be passed to the DB for some reason, either a function isn't a valid database function or it's being joined with a SAS dataset from the work library the whole table from the server is first imported into the SAS session and then the query is executed. This can be quite efficient, so it's in a users interest to understand how this works.

Reeza
  • 20,510
  • 4
  • 21
  • 38
0

Q1: If you run PROC DATASETS on the dataset, you will find it's location in filename field. The same can be achieved if you run DATA SET ATTRIBUTES task in SAS EG.

Q2: As Reeza mentioned, a lot of the queries can be handled by the DB direct. SAS has excellent support for SQL, Oracle and a number of other DBs where intermediary datasets are not necessary.

Q3: If you create a brand new format in your session and don't specify where to store it, it will be stored in your WORK library as a SAS CATALOG. You can examine the contents of that catalogue by running this program: PROC CATALOG CATALOG=WORK.FORMATS;contents;RUN;Usually the default and permanent formats are stored elsewhere. You need to retrieve a content of FMTSEARCH option to examine what locations are loaded for your session. These locations are searched for a format required from left to right. Code to examine the option: PROC OPTIONS option=FMTSEARCH; RUN;

Q4: The question is really about SQL Procedure Pass-Through Facility. You might find this technical document useful. There are a lot of other useful papers, but to answer your specific question in one sentence: yes, the database gets hit all the time. If you want to avoid it, create an overnight ETL process and copy the database onto SAS for daytime processing, but it might be more beneficial to send well formed SQL queries to the database for processing (utilise SQL pass-through facility).

Regards, Vasilij

Vasilij Nevlev
  • 1,449
  • 9
  • 22
  • Thank you Vasilij. So as a administrator, is there any privilege given to him to track what all libraries are there in the work folder. What is the folder format for SAS. Is it like , User(1) { Folder A , Folder B, Work } , User (2) {Folder A , Folder B, Work} or Folder A {User (1) , User(2) } Folder B {User (1) , User(2) } , Work { {User (1) , User(2) } . – user2676132 Jul 04 '16 at 23:59
  • Hey @user2676132 the folder is actual physical folder governed by your OS permissions. In many instances users can FTP to that location and see the folder structure. It is usually something like this: /your_path_to_work_location/SAS_work{random_string}_hostname. If you want to see physical location of your current work folder, query the global macro variable SASWORKLOCATION by running this code: `%PUT SASWORKLOCATION=&SASWORKLOCATION`; – Vasilij Nevlev Jul 05 '16 at 08:45