Hi all,
I have a very long file name which SAS is unable to read (the file name gets cut in the middle). How can I keep the long file name?
I'm just using a data step, and a file statement.
I used the following code:
data _null_;
file "&filename";
I get an error during the run because the filename gets cut. I think I've used a %str function before to retain the long name, but I can't seem to get the code right.
Thank you!
Oh, the stupidity of users. (something I mutter under my breath, and often quite loud, at least 10 times a day).
In this case, try
file "'&filename'";
But I recommend putting up a sign:
"Every third user creating a directory with a blank is shot. Two were already warned."
Would you please post the %let filename= statement?
Hi Kurt,
Here it is:
%let filename = C:\Users\angelique.castaneda\Documents\Work\Practice Codes;
Yes, there is a space between Practice and Codes. In our production paths, some folder names have spaces which we cannot revise to put underscores instead.
Oh, the stupidity of users. (something I mutter under my breath, and often quite loud, at least 10 times a day).
In this case, try
file "'&filename'";
But I recommend putting up a sign:
"Every third user creating a directory with a blank is shot. Two were already warned."
Thank you Kurt!
I tried like below in my SAS EG 5.1. But encountered by error as follows.
I can't guess the likely error in this code.
15 %let filename = "/data/PPM/Sample Check"; **unix folder
16 data _null_;
17 file "'&filename'";
NOTE: Line generated by the macro variable "FILENAME".
17 "'"/data/PPM/Sample Check"
_
23
ERROR 23-2: Invalid option name /.
Pleas don't append your question to an already solved thread. Start a new one instead.
Remove the quotes in the %let statement: %let filename = /data/PPM/Sample Check;
Do not use physical names that was. You can use them by defining a filename and then use fileref(membername) .
I would prefer using:
filename Angel "C:\Users\angelique.castaneda\Documents\Work\" ;
/* by an autoexec usermods as a standard for an application SASApp */
Then proceed:
file Angel("Practice Codes") ;
/* to be used in the same way when needing anchors */
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.