Created
November 10, 2023 21:28
-
-
Save statgeek/c88586561ba3d120844c350f4ef3145c to your computer and use it in GitHub Desktop.
SAS - Read a zipped xpt file into SAS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*path to the zip file; | |
filename src zip "/home/fkhurshed/Demo2/P_DR2IFF.zip"; | |
*path to where to save the xpt file; | |
filename xl "/home/fkhurshed/Demo2/P_DR2IFF.xpt" ; | |
*extract file from zip - P_DR2IFF.XPT in the code below is the name of the file in the zipped file that is to be extracted; | |
data _null_; | |
/* using member syntax here */ | |
infile src(P_DR2IFF.XPT) | |
lrecl=256 recfm=F length=length eof=eof unbuf; | |
file xl lrecl=256 recfm=N; | |
input; | |
put _infile_ $varying256. length; | |
return; | |
eof: | |
stop; | |
run; | |
*where to store the SAS dataset; | |
libname projfile '/home/fkhurshed/Demo2/'; | |
*XPT file (same as filename xl as above); | |
libname xptfile xport '/home/fkhurshed/Demo2/P_DR2IFF.xpt' access=readonly; | |
*extract the SAS dataset from the XPT file; | |
proc copy inlib=xptfile outlib=projfile; | |
run; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment