Help using Base SAS procedures

File Name value exceeds maximum length of 201 characters - UNIX

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

File Name value exceeds maximum length of 201 characters - UNIX

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
Solution
‎05-07-2015 02:58 AM
Respected Advisor
Posts: 4,173

Re: File Name value exceeds maximum length of 201 characters - UNIX

Posted in reply to shivasomaram

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.

View solution in original post


All Replies
Super User
Posts: 5,424

Re: File Name value exceeds maximum length of 201 characters - UNIX

Posted in reply to shivasomaram

Options symbolgen mprint mlogic;

Data never sleeps
New Contributor
Posts: 4

Re: File Name value exceeds maximum length of 201 characters - UNIX

Hi Linus,

Thanks for your response.


Could you please elaborate on what you were mentioning. I did not quite get your point.

Regards,

Shiva.

Respected Advisor
Posts: 4,173

Re: File Name value exceeds maximum length of 201 characters - UNIX

Posted in reply to shivasomaram

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.

Super User
Super User
Posts: 7,039

Re: File Name value exceeds maximum length of 201 characters - UNIX

Posted in reply to shivasomaram

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.

Super User
Posts: 7,762

Re: File Name value exceeds maximum length of 201 characters - UNIX

Posted in reply to shivasomaram

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Solution
‎05-07-2015 02:58 AM
Respected Advisor
Posts: 4,173

Re: File Name value exceeds maximum length of 201 characters - UNIX

Posted in reply to shivasomaram

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.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 2747 views
  • 0 likes
  • 5 in conversation