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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
jakarman
Barite | Level 11

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

8 REPLIES 8
DavidPhillips2
Rhodochrosite | Level 12

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

Kurt_Bremser
Super User

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";

Kurt_Bremser
Super User

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)

jakarman
Barite | Level 11

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 --<-----
DavidPhillips2
Rhodochrosite | Level 12

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.

jakarman
Barite | Level 11

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 --<-----
DavidPhillips2
Rhodochrosite | Level 12

This identified the full path:

%macro grabpathname;

%sysget(SAS_EXECFILEPATH)

%mend grabpathname;

%put %grabpathname;

jakarman
Barite | Level 11

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 --<-----

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

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