BookmarkSubscribeRSS Feed
Gpp
Fluorite | Level 6 Gpp
Fluorite | Level 6

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.

 

2 REPLIES 2
Patrick
Opal | Level 21

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.

Gpp
Fluorite | Level 6 Gpp
Fluorite | Level 6

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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 887 views
  • 0 likes
  • 2 in conversation