BookmarkSubscribeRSS Feed
Dreamer
Obsidian | Level 7

Hi,

My Proc Export is giving following error message:

ERROR: File Name value exceeds maximum length of 201 characters.

My file path + name are 224 characters long.

I was looking in to other posts regarding this and looks like its a Windows limitation.

But I couldn't find any work around. All posts only discussed problem and claims Windows a bad guy for this limitation.

But what's the solution? How we really deal with it?

PS: I'm using SAS 9.4 installed on Windows Server 2012 R2.

9 REPLIES 9
Dreamer
Obsidian | Level 7

Btw I noticed SAS doesn't understand the path if we map part of that to a letter.

So this trick is not helpful.

jakarman
Barite | Level 11

You could also ask the question why in ....name you are wanting that looooooooooooooong names. Can you remember those and type the names.

Than simplifying the naming can help. An oter option could be using a link (link command) for shortening the name, But when it the physical storage convention that will not help. 

---->-- ja karman --<-----
ishmo65
Obsidian | Level 7

SAS filenames aren't always decided upon by the SAS coder. I work in an installation where specific files need to put in a specific folder/path structure in a specific place. I just had this exact issue (hamstrung by 201 characters) last week and had to play around with the base filename (i.e. the name after the last /), plus I have 10 files in total, due to a macro loop - I've succeeded with 9 but struggling to get the 10th one shortened, which I will solve, somehow. Aside from this trivial issue, the point at the start of this response needs to be considered before dismissing comments in such a way, i.e. "Can you remember those and type the names." I don't need to type the names - I have shortcuts in Windows to the locations where my files will reside or a few folder levels higher.

data_null__
Jade | Level 19

Try using a fileref.

filename FT55F001 'path\name.ext';

proc export outfile=FT55F001 <the rest>;

gelisol
Calcite | Level 5

Thanks!  Using a fileref worked for me (SAS 9.4, Windows Server 2012R2)!

 

-Bill

Tom
Super User Tom
Super User

@gelisol wrote:

Thanks!  Using a fileref worked for me (SAS 9.4, Windows Server 2012R2)!

 

-Bill


Sounds like a bug in PROC EXPORT then.  Perhaps you can report it to SAS Support.

ishmo65
Obsidian | Level 7

This is the solution I used - the full path can be put in the quotes without any limits.

Kurt_Bremser
Super User

Operating systems have a limit on filename length. Why? Because they have to reserve that space for filenames in directory files. Allowing arbitrary lengths either cause directories to be harder to handle (no direct indexing possible because of variable lengths) or blow them up considerably in size (causing every access to be slower when the long directory file needs to be read).

SAS itself introduced a limit that was chosen so that it would work on all supported systems.

While PROC EXPORT is platform-independent, the FILENAME statement is part of the SAS system's support for the respective operating system (that's why you find it documented in the Companion for your OS) and is not platform-independent. That is why it can make use of the OS's limitations instead of global limitations.

Use a fileref, but be aware of the Windows limits. And do yourself a favor by making path- and filenames shorter and more readable (and typeable!).

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 9 replies
  • 23216 views
  • 2 likes
  • 7 in conversation