BookmarkSubscribeRSS Feed
sklal
Obsidian | Level 7

Hello everyone,

 

I'm trying to import a particular foxpro database table using the follow

PROC IMPORT OUT=FOXPRO.xxxxxx
DATAFILE="C:\FOXPRO-DBF\xxxx\xxxxxx.DBF"
DBMS=DBFMEMO REPLACE;

 

and it is displaying the error 

ERROR: Import unsuccessful.  See SAS Log for details.

 

What could be the reason and how to fix this? 

I have not faced such an issue in importing any other tables from foxpro or any other database

 

Please help

 

Best regards,

Sanat

 

 

11 REPLIES 11
ChrisHemedinger
Community Manager

Alas @Kurt_Bremser, not necessarily.  I've seen that error myself and details aren't always available.

 

I guess it's better than saying:

 

Import unsuccessful. *shrug*
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
sklal
Obsidian | Level 7

@ChrisHemedinger has rightly pointed out. The details are not available.

Kurt_Bremser
Super User

@sklal wrote:

@ChrisHemedinger has rightly pointed out. The details are not available.



D**n. Worst case situation. Do you still have FoxPro or some other software with which you can inspect the file?

sklal
Obsidian | Level 7

Yes, it had just column names inside it. Same was the case with 47 other such files. The client's foxpro team has now  confirmed that these files were all corrupted. So I guess this error shows when the files are corrupted. 

ballardw
Super User

Run  this code:

proc setinit; run;

proc product_status;run;

 

See if you have SAS/ACCESS Interface to PC Files in both sections of output.

If not in the first then not licensed, if in the first and not the second then the interface wasn't installed.

 

I think the FoxPro memo files are supposed to have a FPT extension. Perhaps you don't want DBFMEMO but DBMS=DBF.

 

One also never quite knows when a hyphen in a path name causes a problem. You might try renaming the FOXPRO-DBF folder with the "-".

sklal
Obsidian | Level 7

Thanks for the response.

 

I don't think there is any licensing issue(I have checked both the statements). Also, I tried replacing dbfmemo with dbf and changed the path name, now it doesn't throw an error but it is not displaying any rows inside the dataset , just blank column names.

 

Is there any formatting issue within the file itself ? Or do I need to make some modifications from my side?

ballardw
Super User

@sklal wrote:

Thanks for the response.

 

I don't think there is any licensing issue(I have checked both the statements). Also, I tried replacing dbfmemo with dbf and changed the path name, now it doesn't throw an error but it is not displaying any rows inside the dataset , just blank column names.

 

Is there any formatting issue within the file itself ? Or do I need to make some modifications from my side?


What size, how many bytes, does the operating system say that file has. If it is under 10K it might actually be empty with only column header information.

 

I was never much of a FoxPro guru but I seem to remember that some of the databases that use DBF formatted files actually have one or two other files that accompanied them. When other programs looked at that data they expected those other files to be in the same location with the same name except a different extension.

 

If you don't have FoxPro but do have Excel you might try opening it with Excel. This is a longish shot, but if it works then you could save from Excel to a CSV file which may be easier to import. You would be reading a delimited file or DBMS=CSV. Use a large value for the GUESSINGROW (32000 or number of lines in the file, which ever is smaller) option to have best chance of Proc Import reading values correctly.

sklal
Obsidian | Level 7

I checked it with Visual foxpro as well as excel and they too were showing just column names inside. Same was the case with 47 other such files. The file(s) size varied between 2KB and 5KB. The client's foxpro team has now confirmed that these files are corrupted. So, it seems this error shows up when the files are corrupted. Not sure if there is any other reason for this error.

Tom
Super User Tom
Super User

Did you check the file to make sure it is actually as DBF or at least a FOXPRO version of a DBF file?

You can get a quick dump of the beginning of the file by using a simple DATA step. For example you could look at the first 800 bytes by running this program.

data _null_;
  infile "C:\FOXPRO-DBF\xxxx\xxxxxx.DBF" recfm=f lrecl=80 obs=10 ;
  input;
  list;
run;

You can find more information on the DBF file format on-line.  Try here.

https://www.loc.gov/preservation/digital/formats/fdd/fdd000325.shtml

 

sklal
Obsidian | Level 7

Yes , it is an actual DBF file but I tried opening the file on Visual Foxpro and excel and the just showed column names. It seems this file and 47 other such files are corrupted. So I guess this error shows up when the files are corrupted. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 11 replies
  • 1576 views
  • 4 likes
  • 5 in conversation