BookmarkSubscribeRSS Feed
alepage
Barite | Level 11

Up to now, I have been using a proc s3 procedure to download file.

But now, I would prefer to use a aws s3 command to download a csv file by specifying the profile I want to use.

 

How do we do that ?

1 REPLY 1
Patrick
Opal | Level 21

Based on documentation and starting with SAS 9.4M5 you can specify the profile with both Proc S3 and the Filename S3 access method. There shouldn't be a need for explicitly calling the aws cli.
Optional Arguments

 

The aws cli command for downloading a file will look similar to below. 

aws s3 cp s3://your-bucket-name/your-file.csv /path/to/destination/ --profile your_profile_name

You need of course the aws cli installed from the environment where SAS executes. 

 

To use a filename pipe with reading the .csv directly via a SAS data step I assume you would need to write directly to standard out. Copilot returned syntax as below for such a scenario.

aws s3 cp s3://your-bucket-name/your-file.csv - --profile your_profile_name --output text

In this command:

  • The - after the S3 path tells the AWS CLI to write the output to stdout.
  • --output text specifies the format of the output. You can also use --output json if you prefer JSON format.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 778 views
  • 0 likes
  • 2 in conversation