BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
shivasomaram
Calcite | Level 5

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

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

6 REPLIES 6
LinusH
Tourmaline | Level 20

Options symbolgen mprint mlogic;

Data never sleeps
shivasomaram
Calcite | Level 5

Hi Linus,

Thanks for your response.


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

Regards,

Shiva.

Patrick
Opal | Level 21

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.

Tom
Super User Tom
Super User

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.

Kurt_Bremser
Super User

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.

Patrick
Opal | Level 21

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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