DATA Step, Macro, Functions and more

How to import a .bcp files?

Reply
Contributor
Posts: 73

How to import a .bcp files?

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

Super User
Posts: 10,044

Re: How to import a .bcp files?

Posted in reply to smilingmelbourne

Did you try to import them by using INFILE statement directly? without Save as TXT file.

Super Contributor
Posts: 474

Re: How to import a .bcp files?

Posted in reply to smilingmelbourne

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

Contributor
Posts: 73

Re: How to import a .bcp files?

Posted in reply to DanielSantos

Thank you, Ksharp and DanielSantos! Very helpful!

Ask a Question
Discussion stats
  • 3 replies
  • 1898 views
  • 6 likes
  • 3 in conversation