DATA Step, Macro, Functions and more

create directory using ftp filename statement

Reply
Occasional Contributor
Posts: 13

create directory using ftp filename statement

Hi

I'm trying to create a directory via the FTP filename statement with no success. The code I'm using is provided below. The TEMP directory already exists. I need to create a subdirectory called test. Any suggestions?

Thanks in advance.

filename dlc ftp "/TEMP/test/" dir new host="&host" user="&userid" pass="&ftppwd" ;
Super Contributor
Super Contributor
Posts: 3,174

Re: create directory using ftp filename statement

Your syntax is correct, per the SAS 9.2 DOC, FILENAME stmt (with FTP access method). Have you attempted to execute the code and you get some type of error? Share your actual SAS log please and help clarify your SAS execution behavior as to what error, if any, is generated by SAS?

Oh yes, let us know that you are able to create the same directory outside of SAS, by the way -- a key consideration to contribute.

Scott Barry
SBBWorks, Inc.


http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a000178980.htm
Occasional Contributor
Posts: 13

Re: create directory using ftp filename statement

Hi Scott

Thanks for the reply. The problem I'm having is when I access the filename within the datastep.

I'm using the filename statement statement as specified and using the below datastep.

data _null_;
file dlc;
run;

I'm able to create the directory using the above. However, I receive the below error message.

ERROR: Invalid Reply received for the STOR command..
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.05 seconds
cpu time 0.01 seconds

Any suggestion?

Thanks in advance.
Super Contributor
Super Contributor
Posts: 3,174

Re: create directory using ftp filename statement

Please share your entire SAS program, pasted from your SAS log!

Scott Barry
SBBWorks, Inc.
SAS Super FREQ
Posts: 8,744

Re: create directory using ftp filename statement

Hi:
With regard to that very same error message, this Tech Support note explains that:
You can use the FTP access method on a FILENAME statement with SAS/GRAPH
device drivers as long as the FILENAME statement references a specific
file (as opposed to a directory location). If you attempt to use the
FTP access method on a FILENAME statement that refers to a directory
location, the following error messages will appear in the SAS Log:

Invalid reply received for the STOR command.
Unable to open graphics device.
Unable to initialize graphics device.


From: http://support.sas.com/kb/1/632.html

Even though your program is not using SAS/GRAPH, you -are- attempting to write to a directory and not to a specific file. You might wish to open a track with Tech Support to determine whether this note is relevant to your issue with FTP filename engine.

Also, this note:
http://support.sas.com/kb/4/470.html
explains that:
When you use the FTP device type with Universal Printing, you may
receive the following error message:

Error: Invalid Reply received for the STOR command...

The reason is that FTP needs write access to a pre-existing file on
the FTP server.


Again, even though this second note was specific to Universal Printing, I sense a "theme" in the use of the FTP filename engine: it might be "happier" if you pointed to a named file. To me, this makes sense. Normally, when I take SAS out of the picture and just use FTP utilities, I am working at the FILE level to FTP back and forth. So I would expect that you can't just FTP a whole directory from within a SAS program -- you'd either have to FTP one file at a time into the directory or use some other kind of process to FTP the contents of an entire directory.

Since these 2 notes do not mention DATA _NULL_ specifically, you might wish to work with Tech Support on this issue. Or, post your entire LOG, as Scott suggests to give folks the most information to attempt to help you.

cynthia
Ask a Question
Discussion stats
  • 4 replies
  • 1253 views
  • 0 likes
  • 3 in conversation