Looks like your SAS server is on a Unix/Linux machine and you are trying to save file on your windows desktop./laptop.
Try saving the file into your workspace on the Linux machine. The following code will give the path of your workspace on server. Anything here would disappear once your session closes.
%let temp_path=%sysfunc(pathname(WORK));
%put &=temp_path;
/* save your file to &temp_path./your_file.txt */
You can save your file to the above location
It might look something like the below. Notice the change I made to the FILENAME. The path is brought in via a macro variable.
%let temp_path=%sysfunc(pathname(WORK));
%put &=temp_path;
FILENAME Out_File "&temp_path/my_file.txt" LRECL=46;
Data _NULL_;
Set Have;
File Out_File;
Put @1 ID
@10 First_Name
@35 Middle_Initial
@36 Last_Name
;
RUN;
Jim
Hello @Boswser
1.The pathname(WORK) gives the full path of your work directory/temp space. This is a location on the server and not on desktop.
2.The full path of the work directory is a dynamic value and it changes with your session. Therefore you should only use the macro and not the physical name. Thus you have the following
/* This line extracts or finds the path*/
%let temp_path=%sysfunc(pathname(WORK));
/* when you want the filename use this :"&temp_path/my_file.txt"
for example thanks to @jimbarbour */
FILENAME Out_File "&temp_path/my_file.txt" LRECL=46;
3.Your SAS Server is on Unix and EG on your desktop. Your code executes on the server
Typically desktop locations under your scenario are not accessible to the code running ion the server.
Thus one cannot use desktop/laptops paths like c:\
You should literally code it with the literal WORK. WORK is the libname. SAS will then retrieve the path for you.
%let temp_path=%sysfunc(pathname(WORK));
Jim
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: