All,
I have file on s3 bucket(static file name ex:test.txt ) and that file over writes everyday.
So I need to read that file based on modified date.
ex:If test.txt modified date is today then run Proc s3 otherwise file is not modified today.
proc s3 config="/u/marti/.tks3.conf";
create "/myBucket";
put "/u/marti/project/test.txt" "/myBucket/test.txt";
run;
Thanks,
SS
Try:
Step 1: Momentarily redirect the log with proc PRINTTO
Step 2: Run proc S3 with INFO statement (or LIST? which one gives you the date?)
Step 3: Stop the redirection: run proc PRINTTO again
Step 4: Run a data steps that analyses the log file.
This data steps triggers a new proc S3 run if the date is as expected.
What do you get when you run the INFO statement?
Doesn't list give you the information you need
proc s3 config="/u/marti/.tks3.conf";
create "/myBucket";
get "/u/marti/project/test.txt" "/myBucket/test.txt";
list "/myBucket";
run;
Sorry to get a file from S3 onto SAS (now used get statement). If I do the list. It is giving the info(modified date )in the log. How can I read that into sas to work with my logic.
ex: if modified date is today then get the file onto sas otherwise no.
you can add the following lines
proc printto log="homeopath/status.txt";
run;
proc s3 step;
proc printto;
run;
read the status from the status.txt
As far as I know one cannot write an if then logic inside a proc step. You have to use two separate steps one to get status and one to read the file itself based on what you find.
Try:
Step 1: Momentarily redirect the log with proc PRINTTO
Step 2: Run proc S3 with INFO statement (or LIST? which one gives you the date?)
Step 3: Stop the redirection: run proc PRINTTO again
Step 4: Run a data steps that analyses the log file.
This data steps triggers a new proc S3 run if the date is as expected.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.