Where are the files that you have access to through SAS® Studio?

This post was kindly contributed by SAS Users - go there to comment and to read the full post.

Where does SAS Studio store files, and how do you access them? The answer: it depends.

For an illustration, submit the following code in SAS Studio:

%put &sysscpl;

%put &syshostname;

%put &sysvlong;

The values that are returned in your log window show which operating system is being used to run SAS, the name of the server that is running Base SAS®, and the version of SAS that is running on that server.

If you are running the single-user edition of SAS® Studio, then SAS®9 is installed on your Microsoft Windows PC locally and you are running SAS Studio on your own personal machine. With this edition of SAS Studio, you can access files on your system and from any mapped drive that uses the Universal Naming Convention (UNC) standard.

However, if you are running an edition of SAS Studio other than the single-user edition, then the files that you create and the files that you have access to are stored on the server where SAS is running.

The server where SAS is running does not have access to the machine from which you are submitting code via the SAS Studio URL in a web browser. In SAS® Studio 3.x, which runs on SAS®9, the Server Files and Folders pane helps you visualize the locations that are accessible to your user ID on the server.

Use the following macro variable to determine where your Home directory is on the server that is running SAS:

%put &userdir;

Your user ID should have Read and Write access to that directory on the file system. Your SAS administration team should have shared best practices for where to store your files on the server and how you can access those files if needed on your local machine. In general, the quickest way to access a file is to right-click it and select Download File, as shown here:

Accessing files in SAS® Studio on SAS® Viya®

On SAS Viya, the file system might not be available to you. If that is the case, your files must be stored in the SAS Content folder. If you are not familiar with the  SAS Content folder in SAS Viya, it is important to understand that the folder does not exist via a physical path on the file system. When you store files in the SAS Content folder tree, you can use the FILESRVC file access method to access them with code. See the examples in Accessing a File by Name and Folder.

To directly bring a file that is stored in the SAS Content folder tree from SAS Studio to your local machine, open the Explorer pane. Right-click the file that you want to access and select Download file:

This blog contains useful information about making files available to the SAS Content folder:

The following SAS Communities blog posts describe how your SAS administrator can make the file system available for you, depending on your version of SAS Viya:

If the file system has been made available for you, then this macro variable contains your default Home directory:

%put &_USERHOME ;

Your SAS server is displayed in the Explorer pane after the Folder Shortcuts entry. As shown below, a myfile.txt file is stored in the Home directory on the file system. Right-click it and select Download file to download it to your local machine:

In the above example, the SAS server is named “NFS mount” and the Home directory is named “Home.” However, the names will be specific to your environment.

Moving files from your local machine to SAS® Studio

To do the reverse and make files from your local machine available to the SAS server where SAS Studio is running, right-click the desired destination folder in the Explorer pane and select Upload files:

Figure 4

I hope that this information helps demystify where your files are stored when you use SAS Studio!

LEARN MORE | SAS TUTORIALS ON YOUTUBE

Where are the files that you have access to through SAS® Studio? was published on SAS Users.

This post was kindly contributed by SAS Users - go there to comment and to read the full post.