0

I was wondering if you could help me understand a piece of SAS code that I found to unzip files from SAS in UNIX? I found this code to zip the file, but I am unsure how to unzip the file.

/*x gunzip /sasdata3/MI/projects/hedis_vendor/production/inovprev/data/download/M201803/Process/unprocessed/invbsca_aba18_detail_fcr_r12_with_ce_20180330_summary_detail_dongmei_march_rolling12_preview_3_31_2018_4_18_26_pm.zip.gz; 
DATA _NULL_; 

tstring='gzip /sasdata3/MI/projects/hedis_vendor/production/inovprev/data/download/M201803/Process/unprocessed/invbsca_aba18_detail_fcr_r12_with_ce_20180330_summary_detail_dongmei_march_rolling12_preview_3_31_2018_4_18_26_pm.zip;'; 

rc = SYSTEM(tstring); 

RUN; */;
momo1644
  • 1,769
  • 9
  • 25
Yvonne
  • 1
  • 1
  • 1
  • What files do you want to unzip? Are they compressed with GZIP , like in the example code you posted, or some other compression utility, like ZIP. – Tom May 08 '18 at 21:48

1 Answers1

0

I hope you find my explanation below useful:

The code you sent is commented out. In SAS any thing between /* some code/comments */ will be treated as comments.

It looks like your environment have X command enabled in SAS; this means you can run Operating System commands via SAS code.

DATA _NULL_; /* Empty data step which will not create any table*/
tstring=' some OS command like gzip or gunzip'; /*The OS cmd is places here*/
rc = SYSTEM(tstring); /*SAS invokes the OS and executes the command saved in the variable tstring*/
RUN;

This code have to commands which you can place either of them in the tstring='';

Zip:

gzip /sasdata3/MI/projects/hedis_vendor/production/inovprev/data/download/M201803/Process/unprocessed/invbsca_aba18_detail_fcr_r12_with_ce_20180330_summary_detail_dongmei_march_rolling12_preview_3_31_2018_4_18_26_pm.zip;

Unzip:

gunzip /sasdata3/MI/projects/hedis_vendor/production/inovprev/data/download/M201803/Process/unprocessed/invbsca_aba18_detail_fcr_r12_with_ce_20180330_summary_detail_dongmei_march_rolling12_preview_3_31_2018_4_18_26_pm.zip.gz; 

gzip & guzip examples

momo1644
  • 1,769
  • 9
  • 25