BookmarkSubscribeRSS Feed
smilingmelbourne
Fluorite | Level 6

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

3 REPLIES 3
Ksharp
Super User

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

DanielSantos
Barite | Level 11

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

smilingmelbourne
Fluorite | Level 6

Thank you, Ksharp and DanielSantos! Very helpful!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 3534 views
  • 6 likes
  • 3 in conversation