Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to read DBF files into stata 13.1

    Dear Statalister,


    I trying to import DBF file into Stata with using this command:
    Code:
    shp2dta using Data_401, data("Data_2") coor("Data_2")
    the name of DBF file is Data_401

    But might be I missed something in the commands which is not working

    All your helps and advices would be high appreciate

    Thank you

  • #2
    Please guys, I need your helps

    Thank you

    Comment


    • #3
      "not working": see FAQ Advice on why this tells us almost nothing.

      shp2dta (SSC) is for the specific purpose of reading a .shp file and a linked .dbf file as a preliminary to using spmap. Is that what you are trying to do?

      (Don't bump after just 32 minutes please!)

      Comment


      • #4
        Dear Mr. Nick Cox,

        Thank you for helping,

        I dont think so that I need this :using spmap As I have checked over here: http://www.stata.com/support/faqs/graphics/spmap-and-maps/
        this is more for mapping.


        My data is microdata of household but data is in DBF format, which I have to import to Stata which I dont know how to do it.

        Thank You

        Comment


        • #5
          Let me echo Nick's request that you read the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. See especially sections 9-12 on how to best pose your question. It's particularly helpful to copy commands and output from your Stata Results window and paste them into your Statalist post using CODE delimiters, as described in section 12 of the FAQ.

          There are lots of reasons why the command might not work, and knowing what Stata told you is important.

          Comment


          • #6
            Dear Statalister,


            I trying to import DBF file into Stata with using this command: Code:

            Code:
            shp2dta using Data_401, data("Data_2") coor("Data_2")
            the name of DBF file is Data_401

            But might be I missed something in the commands which I am getting this error message:
            Code:
            file Data_401.shp not found
            r(601);
            While the name of file is Data_401 ( as DBF format).


            All your helps and advices would be high appreciate

            Thank you Tags: None


            Comment


            • #7
              Thanks for providing extra detail, but the main answer is already given in the program help and in #3 .

              This program is not for importing any .dbf whatsoever. It expects to see two files, one an .shp file. You don't have that, so it fails.

              I don't know a way to import .dbf directly to Stata. You may need to convert it to some other format first. MS Excel or Stat/Transfer should help.

              Comment


              • #8
                Dear Nick

                Yes , I am agree with you in this issue,

                Thank you

                Comment


                • #9
                  There are some Java libraries floating around for reading .DBF files that you could probably use to parse and push the data from the .dbf file into Stata.

                  Comment


                  • #10
                    Dear wbuchanan

                    Thank you for could you give the exact name of some " Java libraries floating" which I could search more easily ?

                    Thank you

                    Comment


                    • #11
                      Rais: I am sure Billy is right, but I am guessing that you don't have experience in Java programming, but do have access to MS Excel, so why not try that first? As said, read into Excel then import into Stata.

                      Comment


                      • #12
                        Dear Nick

                        Right I followed your suggestion and have done it already, but I just wanted to know if there is possibility still why not, for next time or someone will face in such problem which we could share our experience.

                        Thank You

                        Comment


                        • #13
                          FWIW, if you will find yourself often needing to read .dbf files or other data formats that are not native to Stata (or handled by commands like -import excel-) consider purchasing StatTransfer. It can translate freely among a wide range of formats for database, spreadsheet, and statistics programs. In addition to having both a command line and graphical user interface, it also comes with a set of .ado files [originally written by Roger Newson, I believe] that enable you to invoke it directly from Stata's command line or a do-file. It is very reasonably priced for the functionality it provides, and the user support is outstanding. For my work, it is an indispensible tool.

                          (No disclaimer here: I have no relationship to Circle Systems other than a very satisfied customer.)

                          Comment


                          • #14
                            Rais Taj one potential reason is that the .DBF file format is a bit of a legacy that has stuck around primarily due to it's inclusion with ESRI ShapeFiles to store attribute data on the geometries contained in the .shp file. Below are some links to different Java libraries that are either directly or tangentially related to parsing/writing .DBF files.

                            https://github.com/jamel/dbf
                            http://geotools.org/
                            https://github.com/Esri/geometry-api-java
                            https://github.com/iryndin/jdbf
                            http://sourceforge.net/projects/dans-dbf-lib/
                            http://xbasej.sourceforge.net/

                            Comment


                            • #15
                              Dear wbuchanan

                              Thank you for very very useful sources

                              Comment

                              Working...
                              X