Scénario de test & Cas d'usage
This scenario assumes an S3 bucket exists and contains a 'customer_campaign.csv' file. No data step is needed, but the S3 credentials (key, secret) and bucket details must be configured in the environment or specified directly.
| 1 | /* Pre-requisite: An S3 bucket 'my-marketing-bucket' exists in the 'us-east-1' region and contains the file ' |
| 2 | data/customer_campaign.csv'. AWS credentials must be configured for the CAS server. */ |
| 1 | PROC CAS; |
| 2 | TABLE.addCaslib / |
| 3 | name="MarketingS3" |
| 4 | description="Marketing Campaign Data from S3" |
| 5 | dataSource={srcType="S3", |
| 6 | accessKeyId="YOUR_AWS_ACCESS_KEY_ID", |
| 7 | secretAccessKey="YOUR_AWS_SECRET_ACCESS_KEY", |
| 8 | bucket="my-marketing-bucket", |
| 9 | region="us-east-1" |
| 10 | } |
| 11 | SESSION=true |
| 12 | activeOnAdd=true; |
| 13 | RUN; QUIT; |
| 1 | PROC CAS; |
| 2 | TABLE.caslibInfo / caslib="MarketingS3"; |
| 3 | SESSION.sessionStatus; |
| 4 | RUN; QUIT; |
| 1 | PROC CAS; |
| 2 | TABLE.loadTable / |
| 3 | caslib="MarketingS3" |
| 4 | path="data/customer_campaign.csv" |
| 5 | casOut={name="campaign_data", caslib="MarketingS3", replace=true}; |
| 6 | RUN; QUIT; |
The 'MarketingS3' caslib is successfully created and set as the active caslib. The caslibInfo action confirms its existence and S3 data source configuration. The loadTable action successfully loads 'customer_campaign.csv' into a CAS table named 'campaign_data'. The caslib will be automatically dropped at the end of the session.