A FILENAME can be seen as a variable that is specifically used in SAS to refer to a location of file. This is useful, because then we do not have to type the whole path everytime we want to use this file in a script.
There are two ways of declaring a FILENAME variable, dependent on where the file you want to access, is stored. The difference is:
The file server (in the image below called ‘...-notilyze’, but the name can differ per server)
SAS Content
1. In the case of accessing a file from the file server, use the following syntax to create a variable ‘fitFile’ that holds the location (between double quotation marks):
/* Get a file from the fileserver (in this case of a static data source, to use in code later) */ 2FILENAME fitFile "/sasdata/projects/shared/fit_input.csv";
2. In the case of accessing a file from SAS Content, use the following syntax to create a variable ‘dirList’ that holds the location (folderpath + filename):
/* Get a file from SAS Content (in this case with a Macro function, to use in your code) */
FILENAME dirList FILESRVC folderpath="/Projects/shared/SASTools/" filename="Macro_dirlist.sas";