Hi i am in new in SAS and try to extract the below dataset in Excel using the code below.
However, i receive this error message (i have deleted the full path after the "resolves to")
SYMBOLGEN: Macro variable OUTPUT_LOC resolves to........
ERROR: File Name value exceeds maximum length of 201 characters.
Any help would be appreciated
data mydata1; input IDnumber $ Week1 Week16; datalines; 2477 195 163 2431 220 198 2456 173 155 2412 135 116 ; run; proc export dbms=excelcs data= mydata1 outfile="&output_loc.\mydataexp.xls"; sheet=test1; version="2002"; server='servername'; port=8888; serveruser=&LAN_username.; serverpass="&LAN_password."; run;
The path you are using is NOT valid on the machine where SAS is running.
That is why your original code is the SAS PC FILES server.
So the issue is that you have created an unwieldy naming convention that has resulted in a filename that is not only impossible for humans to comprehend but exceeds the limits that this SAS process has.
If cannot get that naming convention shorted to something that is less than 200 characters then it sounds like your only choices are:
1) Get your UNIX support team can mount the shared disk on the UNIX machine where SAS is running. Then use the UNIX path that they created for the shared disk to write to the file from SAS as in the code I posted.
2) Have the WINDOWS support team that is running the WINDOWS machine where the SAS PC FILES server is running to map a drive letter to some part of that shared folder path so that the path you pass can be less than 200 characters.
Someone else just had the same problem with PROC EXPORT. There appears to be a bug in the code in PROC EXPORT that is limiting explicit filenames in the call to 200 characters. I believe they solved it by making a fileref and using that in the PROC call.
filename myfile "&output_loc.\mydataexp.xls";
proc export dbms=xlsx
data= mydata1
outfile=myfile;
sheet=test1;
run;
But I don't think that will work if you are trying to use the SAS PC FILES server to write your excel file to some location that SAS cannot write to itself.
hi, thanks. Yes, it does not work. I run it and saw the below in the log (i have replaced the path with dots (.....)). I did not receive any errors thought. I try to save it in a shared drive
Is there any workaround ?
ERROR: Temporary file for XLSX file can not be created -> /sas94/lev3/config/grid/Lev3/SASMain/\\..................................xls.$$1. Make sure the path name is correct and that you have write permission. NOTE: The SAS System stopped processing this step because of errors.
The path you are using is NOT valid on the machine where SAS is running.
That is why your original code is the SAS PC FILES server.
So the issue is that you have created an unwieldy naming convention that has resulted in a filename that is not only impossible for humans to comprehend but exceeds the limits that this SAS process has.
If cannot get that naming convention shorted to something that is less than 200 characters then it sounds like your only choices are:
1) Get your UNIX support team can mount the shared disk on the UNIX machine where SAS is running. Then use the UNIX path that they created for the shared disk to write to the file from SAS as in the code I posted.
2) Have the WINDOWS support team that is running the WINDOWS machine where the SAS PC FILES server is running to map a drive letter to some part of that shared folder path so that the path you pass can be less than 200 characters.
Worked for me. Thank you!
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.