Hi all,
I know I can gzip file in SAS using below method.
x gzip "/&path./Report20190701_20190705.txt";
But instead of using full filename--> Report20190701_20190705
, can I just write partial of the filename ?
Such as --> Report201907*.txt ? I tested this * but failed, wondering if any other method?
I wish to automate the housekeep step in the code, to zip previous month report. However, I wouldn't know what is the filename without manually open the path and check.
Sample filename I will have in the path :
Report20190606_201905030
.txt
Report20190615_20190601
.txt
Report20190626_20190613
.txt
Report20190701_20190605
.txt
Report20190707_20190623
.txt
Report20190718_20190704
.txt
If possible, everytime I run the code, I would like to zip previous month file, which are all file start with Report201906xxxxxxx
Thank you in advance.
What failed?
Have you already tried to execute the command directly out of a command prompt ("putty").
And last but not least:
I normally prefer to execute such commands via a Filename Pipe as this allows to capture the messages from the shell and write it back to the SAS log.
Hi Patrick,
I tried X gzip "/&path./Report201905*.txt";
But the file didnt zip,
when I use X gzip "/&path./Report20190501_20190524.txt";
Then the file will be zipped.
May I know what is filename pipe? thanks.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.