Hi,
I received from a data vendor a bunch of data files with .bcp file extensions and a little application 'gzip'. They told me to unzip the files and rename them as .txt files before importing into SAS in the usual way.
After unzipping these .bcp files, however, I found out that they remain .bcp files. So I came up with a solution myself by opening those unzipped files with Notepad++ and Save Aa them as .txt files. For these files, I was able to import them all into SAS.
However, many of the unzipped files are too large to be clicked open in Notepad++, so I could not import them into SAS.
Could you please show me how to fix this issue? Each of the files are in several GBs and cannot be openned in Notepad++ or anything to save them as .txt files. I don't know how to read them into SAS.
Thanks so much
Did you try to import them by using INFILE statement directly? without Save as TXT file.
Although having a wrong extension, from what you're saying those files are compressed (zip).
Once decompressed you're good to go, no need to open them through anything else.
Seems you're just using Notepad++ to rename the extension. Unless Notepad++ is translating something in the process, say line feed/carriage return codes. Either way, I see no need to pass them through Notepad++, SAS will import them fine directly (after decompressed), as Ksharp suggestion.
If you care to bypass the unzip process outside SAS, you may try to pipe the unzip command from infile, like this:
data _null_;
infile 'unzip -p C:\INPUT\MYFILE.bcp' pipe; * -p option pipes the content;
input;
put _infile_;
run;
NOTE: -p option of my unzip command line utility pipes the content of the zip, for winzip it's the -c option, you'll have to check the utility your using, and get the correct option flag.
Another way, would be to use SASZIPAM engine, which is a "use at your own risk" feature: http://support.sas.com/kb/31/244.html
But I wouldn't recommend it for big files like yours.
Cheers from Portugal.
Daniel Santos @ www.cgd.pt
Thank you, Ksharp and DanielSantos! Very helpful!
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.