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
"See SAS Log for Details." lets me think there is more in the log of the import step.
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*
@ChrisHemedinger has rightly pointed out. The details are not available.
@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?
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.
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 "-".
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?
@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.
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.
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
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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: