SAS has supported cloud object storage for years now, starting with AWS S3 and then Azure ADLS. Google Cloud Storage or GCS was the only missing one in the SAS picture among the “big three” cloud providers. Now it’s done! A new GCS CASLIB has been introduced in the recent 2021.1.2 stable release.
Let’s have a look at it!
How to setup the GCS CASLIB?
Simple. You just have to define:
Here is an example:
caslib gcs datasource=(srctype="gcs" bucket="gcs_dm"
gcsauthfile="/gcpdm/sa/gel_gcpdm_sa_key.json")
path="data" subdirs libref=gcs ;
Here, my “gcs_dm” bucket contains a “data” root folder. The credentials file contains the GCP project to connect to. Now you can start using the GCS CASLIB as you would use any CASLIB.
Supported File Types
In this first iteration, only single CSV files are supported. You can load a CSV file from GCS to CAS and you can save a CAS table to GCS as a CSV file.
proc casutil incaslib="gcs" outcaslib="gcs" ;
load casdata="contact_list.csv" casout="contact_list" ;
quit ;
proc casutil incaslib="gcs" outcaslib="gcs" ;
save casdata="prdsale" casout="prdsale.csv" ;
quit ;
Loading is done in parallel in case of an MPP CAS. Saving to CSV is always serial. More information in the documentation.
In the User Interface
To define a GCS CASLIB in the user interface ("Manage Data" or SAS Environment Manager "Data"), you need to define the type to Other and define the GCS CASLIB options as "Additional Parameters" as shown below:
Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.
Conclusion
SAS Viya has now a pretty good coverage of the main cloud object storage providers. After AWS S3 and Microsoft Azure ADLS, Google Cloud Storage has been added.
CI/CD allows R&D to deliver new features every month, even if they don’t provide full capabilities yet. The GCS CASLIB will be enriched in the next few months.
Thanks for reading.
Find more articles from SAS Global Enablement and Learning here.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.