?>Array ( [id] => 63 )
Scénario de test & Cas d'usage
Define the ingestion caslib and a SAS macro to generate a list of directory names for batch creation. This simulates a real-world automation script.
| 1 | PROC CAS; |
| 2 | caslib ingestionZone path='/cas/data/ingest' dataSource={srcType='path'}; |
| 3 | RUN; |
| 4 | %macro create_daily_folders(caslib_name, num_days); |
| 5 | %DO i = 1 %to &num_days; |
| 6 | %let folder_name = %sysfunc(intnx(day, %sysfunc(today()), -&i), yymmddn8.); |
| 7 | PROC CAS; |
| 8 | TABLE.addCaslibSubdir / |
| 9 | lib="&caslib_name", |
| 10 | path="&folder_name", |
| 11 | perms='PRIVATE'; |
| 12 | RUN; |
| 13 | %END; |
| 14 | %mend create_daily_folders; |
| 1 | %create_daily_folders(ingestionZone, 50); |
| 1 | PROC CAS; |
| 2 | TABLE.fileInfo RESULT=r / caslib='ingestionZone'; |
| 3 | RUN; |
| 4 | PROC PRINT DATA=r.FileInfo; where FileType='D'; RUN; |
| 5 | PROC sql noprint; |
| 6 | select count(*) into :dir_count from r.FileInfo where FileType='D'; |
| 7 | QUIT; |
| 8 | %put NOTE: Found &dir_count directories.; |
The macro should execute without errors, rapidly creating 50 distinct subdirectories named by date (e.g., '20251124', '20251123', etc.) within the '/cas/data/ingest' path. The final verification step should print a list of directories, and the SAS log should display 'NOTE: Found 50 directories.', confirming that the action performed correctly and efficiently in a batch automation context.