BookmarkSubscribeRSS Feed
GKJohn1
Calcite | Level 5

Hello, I have not worked much with FTP, but I know a little bit.

 

I am able to successfully use what is below to put a file in the appropriate folder.

however, I would like to put a new file in a new folder every week (by week ening)

 

so that in the folder  /WEEKLY/Sunday/ 

 

there would be names of folders something like

jan-16-2021

jan-23-2021

jan-30-2021

 

etc.  or does not have to be like that, the month could be a digit (1 in this case for Jan).

so, my question is how do I create a new folder here for every week?  thank  John

 

$ FTP QUALITY.AKST.COM /USER='PWD_ID'/PASSWORD='PWD_PWD'       

QUOTE CWD /WEEKLY/Sunday/        

put QUAL_LIS:BUY_H.LIS BUY_H.LIS           

EXIT

5 REPLIES 5
SASKiwi
PROC Star

Where does SAS come into this?

GKJohn1
Calcite | Level 5
good question. I am so used to doing nothing but SAS here, and in my command procedures I have always run a SAS program, so in retrospect, I guess it is not really a SAS question. the files I am referring to were created by a SAS program. that said, is there a place in this community that would apply to this question? I guess it is still SAS related because it is a coding question that is run on the SAS environment. thanks
ballardw
Super User

If you can run a command file that does the FTP upload/ download you could use the information from SAS to write the file.

If the X command is not disabled in your set up you could run the command file from SAS.

 

You might need to be more specific in your ftp commands than in an interactive FTP program such as if you have to make / change directories and setting the default file type(binary or ASCII )

 

GKJohn1
Calcite | Level 5

I am not sure what you mean.  sorry, I can write SAS code, but when it comes to code with command procedures, I am kind of a novice.

 

I guess I was thinking something like a loop depending on the day, so that if it is run on say, Thursday, jan 21st, it would go back five days, and created a folder titled 1-16-19, so it would do something like weekday (date) minus some number, always resulting in the preceding saturday to put in the created saturday folder.    but I have never used a macro or loop to create many folders.  does it make sense what I am asking?  

ballardw
Super User

I suggest working with one your admins or sysops that know your version of the FTP program.

Provide and explicit example to them of everything you need to do for one case including the names of any files that you want to move as an example. I suggest at least 2 files.

 

You need to know which options your process will actually need and then use them.

You may be able to use the FILENAME filerf FTP to assign the connection strings and options and write the data. There are way too many options to copy the entire documentation so search your SAS documentation for "Filename Statement, FTP"

Or hopefully:

 

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=lestmtsglobal&docsetTarge...

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 5 replies
  • 1179 views
  • 0 likes
  • 3 in conversation