Architecting, installing and maintaining your SAS environment

Shared File Library in SAS 9.2

Accepted Solution Solved
Reply
Super Contributor
Posts: 483
Accepted Solution

Shared File Library in SAS 9.2

Can someone direct me to documentation that explains how to create a shared file library in SAS 9.2 and how to create a basic code block that is shared with another SAS file via an include statement.  I found a lot of documentation online about using include but none that explains how to create a file library in Management Console.


Accepted Solutions
Solution
‎06-30-2015 09:03 AM
Valued Guide
Posts: 3,208

Re: Shared File Library in SAS 9.2

Check the filename statement. It supports the same approach has as a libname disconnect ting from a physical location. When you have a fileref  like a libref you can use that one with including sources.this HTML class.

http://support.sas.com/documentation/cdl/en/hostunx/67464/HTML/default/viewer.htm#n1cwdt7h01vaken0zl...


The syntax will be " %Inc fileref (sas_source) ; " it is like using pds members on a mainframe. Concatenation is possible and can solve dtap approaches. More advanced is using catalog members that are stored in sas libraries. It is technical more complicated but solves os differences.

You have found some things about that. But I am missing what your issues are. Most likely the abstraction when done is easy but the abstraction step is difficult.

---->-- ja karman --<-----

View solution in original post


All Replies
Super Contributor
Posts: 483

Re: Shared File Library in SAS 9.2

Related is there a way to reference a SAS file via an include statement in the same directory

  1. e.g.

%include \current directory\util.sas

Super User
Posts: 6,963

Re: Shared File Library in SAS 9.2

In SAS you can address files by absolute or relative path. The relative path will start in the current working directory of the SAS process, so it is best to always use absolute paths.

One way to solve your problem is to set the path in a separate macro variable, so you need to set it only once:

%include "&your_path./&your_file";

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Posts: 6,963

Re: Shared File Library in SAS 9.2

When you store objects (like Enterprise Guide projects) in metadata, SAS uses a webdav server for the objects and stores only links in the metadata.

How to set up shared includes depends very much on your setup (remote/local, OS type, security considerations)

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Solution
‎06-30-2015 09:03 AM
Valued Guide
Posts: 3,208

Re: Shared File Library in SAS 9.2

Check the filename statement. It supports the same approach has as a libname disconnect ting from a physical location. When you have a fileref  like a libref you can use that one with including sources.this HTML class.

http://support.sas.com/documentation/cdl/en/hostunx/67464/HTML/default/viewer.htm#n1cwdt7h01vaken0zl...


The syntax will be " %Inc fileref (sas_source) ; " it is like using pds members on a mainframe. Concatenation is possible and can solve dtap approaches. More advanced is using catalog members that are stored in sas libraries. It is technical more complicated but solves os differences.

You have found some things about that. But I am missing what your issues are. Most likely the abstraction when done is easy but the abstraction step is difficult.

---->-- ja karman --<-----
Super Contributor
Posts: 483

Re: Shared File Library in SAS 9.2

To use the filename statement it looks like I need to reference the full server path of the SAS file I am including.  Is there a way to know what this path is?

All of the examples that I see online state C:/file name rather than the SAS server path.

Valued Guide
Posts: 3,208

Re: Shared File Library in SAS 9.2

David, the naming convention wit a drive letter is the full physical path as related to the windows machine the process is running on. That is what you find in the examples.

Reading your question it could be you are asking for resources on other windows machines. That could be solved in different ways.

An admin on a windows domain could set up a dfs approach. By that the domain network connections are made on that server to possible many other locations and machines. Still offering that local drive letter but hiding all those other machines. That is often used as it made migrations easy.

Having unc names wit a server name \\server\networkname  with the server in the same netbios dns  name or using the full ip a dress you can explicitly use other machine resources.

All is there at http://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/viewer.htm#refextfile.htm

That unc naming usage is with a windows sas session and not that easy with Unix.  The member fileref usage is generic.

---->-- ja karman --<-----
Super Contributor
Posts: 483

Re: Shared File Library in SAS 9.2

This identified the full path:

%macro grabpathname;

%sysget(SAS_EXECFILEPATH)

%mend grabpathname;

%put %grabpathname;

Valued Guide
Posts: 3,208

Re: Shared File Library in SAS 9.2

Dave that one is windows specific for the DMS approach. See 2010 tt_sas01 making your Sas programs environment aware. It is a setting just got from the OS and Sas config.

It will not work in a sas bi/di approach what is getting more common these days as server based.

As for batch or analytics the evironment dtap and program as sysin option or in stream code are known at start why are you trying to detect that afterwards. Use the knowledge you have at the start of programs or code.

---->-- ja karman --<-----
☑ This topic is solved.

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

Discussion stats
  • 8 replies
  • 979 views
  • 3 likes
  • 3 in conversation