Amadeus cookies policy - you'll see this message only once.

Amadeus use cookies on this website. They help us to know a little bit about you and how you use our website, which improves the browsing experience and marketing - both for you and for others. They are stored locally on your computer or mobile device. To accept cookies, continue browsing as normal. Or, go to the privacy policy for more information.

Creating an External File in the SAS Workspace

It can sometimes be useful to create a temporary flat file that is specific to your SAS session. If you create the file inside your SAS workspace, no-one else can see it or overwrite it, so you don't have to worry much about what name to give it. Here's one way of doing this:

proc sql;
  select path into :workpath
  from sashelp.vslib
where libname='WORK';
quit;  

filename temp "%qtrim(&workpath)/tempfile";  

data _null_;
  file temp;
  put "Some text to be written to the external file";
run;  

We discover the pathname of the WORK library by looking it up in the SASHELP views and saving it into a macro variable. Then we can define the filename we need (using %QTRIM to deal with any trailing spaces).