07-12-2016 01:26 AM - edited 07-12-2016 01:31 AM
I want to extract SAS datasets from a Zip file using SAS unix. I want to save these extracted datasets to a particular directory.
And if Zip file is password protected then how to extract SAS datsets from Zip file to a specified directory in SAS UNIX environment.
I am doing this to have automation in my code. Need help.
07-13-2016 10:58 PM
I can use X commands but i dont know how to use it in SAS (Unix environment).
If you have any solution it will be great.
07-12-2016 05:37 AM
I generally don't recommend just automating an extract. To do things safely you should have a full process of handling the data, from where to save the zip, how to unpack, how to validate everything worked, how to validate the data against the import specification etc. Just unpacking a zip doesn't provide much information of the process.
07-13-2016 11:12 PM
Thanks for your inputs sir.
But i have a requirement like this and need to complete this.
e.g. If Zip file is saved on "C:\input\DS.zip" which contains Datasets then i wanted these datasets to be extracted at "C:\output" folder.
I am able to do this on my windows PC using X command. but i have this requirement in UNIX. So i am not at all hands on UNIX. So doesnt know how to use X command in Unix.
Following code i have used to extract datasets in windows environment:
%LET PASS = Abc123;
x unzip -o -P &PASS "C:\input\DS.zip" -d "C:\output";
If you have any method to do the same in Unix environment. it will be great thank you so much.
07-14-2016 01:01 AM
You should be able to google the relevant commands for UNIX.
I would first find the relevant command on my UNIX box and then implement it in SAS.
07-14-2016 04:54 AM
Well, I return to my post above, its is about the process, not coding. You need to create a workable, validatable, and reproduceable process for the import of data. You say if a file <xyz> contains <data> then <do>. That is a process. First you need a method of securely and surely recieving said file. How will you do that in a consitent manner over the lifetime of the process? Now what the file contains - what does data mean, XPT files, CSV, datasets etc., could be all number of things, where is the data import agreement which details what is contained, and some sort of spec to validate it against. Then the <do> part is to publish it to production for others to use.
Of course, if you want to save yourself the trouble just do it manually.