SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
woo
Barite | Level 11 woo
Barite | Level 11

Hello community, need help please. 

 

i am trying to send file from SAS 9.4 M7 linux server to aws s3 where i have bucket and folder created with below code and receives error message. I have read this article where they are asking to get client id and secrete. Is this something must to do the handshake or we have work around?

 

Have fill access to s3 bucket. 

 

/*code*/

%macro mytest;

%let file_path=/server/path/where/file/is/test.txt

%if %sysfunc(fileexist(&file_path.)); %then %do;

%put file &file_path. exist.;

 

filename s3 "s3://s3-bucket-name/folder";

filename local "&file_path";

 

data _null_;

infile local;

file s3;

input;

put _infile_;

run;

%end;

%else %do;

%put File &file_path. doesn't exist. ;

%end;

%mend;

%mytest;

 

====================

 

Error: physical file doesn't exist, ..../sasconfig/Lev1/SASApp/s3://s3-bucket-name/folder.

 

 

 

 

1 REPLY 1
SASJedi
Ammonite | Level 13

I would think that, at the least, you would have to provide AWS configuration information and credentials before being allowed to write to AWS S3. In the FILENAME S3 documentation, Example #5 includes an example of using the AWSCONFIG= and AWSCREDENTIALS= options (the documentation for these is in the PROC S3 documentation).

The example code looks like this:

filename myout s3 "/my-dir/u1.txt" 
               awsconfig="/u/qz/.aws/config" 
               awscredentials="/u/qz/.aws/credentials" 
               encoding="utf-8";

  Hope this helps get you started. 

Check out my Jedi SAS Tricks for SAS Users

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 1 reply
  • 367 views
  • 0 likes
  • 2 in conversation