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