- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am working on the below program but this is throwing an error with one of the files.
%MACRO CLEAN_TEXT(PATH,DSN,FILENAME,DLM,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
PROC EXPORT DATA=&DSN.
OUTFILE="&PATH./&FILENAME..txt"
DBMS=DLM REPLACE;
DELIMITER= "&DLM.";
RUN;
%MEND CLEAN_TEXT
So, just to explain, the above macro considers 10 arguments. Out of these, the first three correspond to the location (address of the folder to which the dataset is to be exported), dataset name and the filename that is to be used for saving the text file.
I am running this macro on a UNIX environment under SAS 9.4
The issue that am facing is that for creating a particular text file when I pass on the arguments SAS is throwing below the error,
ERROR: File Name value exceeds maximum length of 201 characters.
I would be very much happy if somebody could share some information about this error message so that I could fix my program.
Thanks,
Shiva.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Found it: 20919 - ERROR: File Name value exceeds maximum length of 201 characters
Usage Note 20919: ERROR: File Name value exceeds maximum length of 201 characters
The maximum file name length for OUTFILE= in PROC EXPORT is limited to
201 characters. Specifying a path with more than 201 characters will
generate the following ERROR in the log:
ERROR: File Name value exceeds maximum length of 201 characters.
To specify more than 201 characters in a path, issue a FILENAME
statement prior to the PROC EXPORT step. Use the FILEREF in the PROC
EXPORT code for the OUTFILE= value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Options symbolgen mprint mlogic;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Linus,
Thanks for your response.
Could you please elaborate on what you were mentioning. I did not quite get your point.
Regards,
Shiva.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Copy your error message into a Google search as you're not the first one who encounters this problem.
For the resolved string "&PATH./&FILENAME..txt": Are you able to create such a file manually (e.g. using WinSCP)? There are also UNIX restrictions on how long a paths and file-name can be.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
That sounds like a limitation that PROC EXPORT is imposing.
You could try using a CD command to change the current working directory so that the total length of the string passed to PROC EXPORT is shorter since it doesn't include the path.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Look at the contents of &path and &filename. Either they actually are too long and need to be shortened logically or you have strings with unneeded blanks that could be TRIMed away when creating the path and file names.
Your operating system will impose a limit on path and filename lengths (which is reasonable, overlong filenames make handling such directories extremely unpleasant, and accepting them would also unnecessarily increase the size of ALL directory files in the system).
SAS probably tries to be on the safe side with the 201 character limit, which is less than the 260 imposed by windows and the 255 of (eg) JFS/JFS2 on AIX.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Found it: 20919 - ERROR: File Name value exceeds maximum length of 201 characters
Usage Note 20919: ERROR: File Name value exceeds maximum length of 201 characters
The maximum file name length for OUTFILE= in PROC EXPORT is limited to
201 characters. Specifying a path with more than 201 characters will
generate the following ERROR in the log:
ERROR: File Name value exceeds maximum length of 201 characters.
To specify more than 201 characters in a path, issue a FILENAME
statement prior to the PROC EXPORT step. Use the FILEREF in the PROC
EXPORT code for the OUTFILE= value.