Announcement

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

  • How to determine the version of a Stata dataset


    There must be a (probably simple) way to determine the version (or the format number) of a dataset, but I did not succeed in finding out how. Some of you guys know, I know.

  • #2
    I do not know a simple way to achieve this, but this piece of information can be read from the header of the dataset. See help dta for more information. One (complicated) way to retrieve this information would be to read the header of the file with the Stata file command or the fopen() function in Mata and look for <release>...</release>. I have to admit that I would think twice before choosing this solution. If anyone knows a more obvious way I would like to know too

    Comment


    • #3
      Got it:
      Code:
      . help dtaversion
      
      . dtaversion ex50.dta
        (file "ex50.dta" is .dta-format 115 from Stata 12)
      
      . return list
      
      scalars:
                  r(version) =  115

      Comment


      • #4
        As simple as that! Thanks. With "findit dta version" it's easy to find, but you have to figure it out...

        Comment


        • #5
          Trying using "findit dta version" in Stata 13 but the results doesn't include the user written command "dtaversion". Any ideas of why this is the case?

          Comment


          • #6
            In Stata 13 and up dtaversion is an official Stata command. Type -help dtaversion-. It is also easier to find if you leave out the space, e.g. -findit dtaversion-.
            -------------------------------------------
            Richard Williams, Notre Dame Dept of Sociology
            StataNow Version: 19.5 MP (2 processor)

            EMAIL: [email protected]
            WWW: https://www3.nd.edu/~rwilliam

            Comment


            • #7
              I had done tried this but it seems it isn't installed since there is no help for the command . I also used both "findit dtaversion" and "findit dta version" but the results didn't include the command. Am using SE version of Stata, not sure if this makes a difference.

              Comment


              • #8
                Richard is finding it. Did you update your version?

                Comment


                • #9
                  Thanks everyone. It's now working on Stata 13.

                  Comment


                  • #10
                    To add detail: This command was added during the lifetime of Stata 13, so you must update your copy of 13, or be using Stata 14 up.

                    -------- update 31mar2014 ------------------------------------------------------------------------

                    1. dtaversion and dtaverify are new, undocumented commands in Stata. "Undocumented" means
                    the commands are not documented in the manuals but are documented online.

                    dtaversion reports an internal .dta file-format version number and the corresponding
                    Stata version number. The command is probably of little interest outside StataCorp.

                    dtaverify confirms the consistency of a .dta file; that is, it checks whether the .dta
                    file is corrupt. For most of us, this command is useful when we want to determine the
                    file is not damaged from an accident, say, coffee spilling on the computer.
                    Programmers writing programs to write Stata .dta files will find dtaverify even more
                    useful because they can use it to debug their programs. dtaverify provides a lot of
                    useful information when the .dta file has errors.

                    Comment


                    • #11
                      "probably of little interest"????
                      I think StataCorp seriously underestimates how many older Stata files are sitting around in project folders!
                      Doug Hemken
                      SSCC, Univ. of Wisc.-Madison

                      Comment


                      • #12
                        @Doug Yes indeed, but older Stata files are likely to be readable by any recent version of Stata. The question Can I read this dataset? can be answered by trying.

                        If a dataset is too recent to be read, will dtaversion in 13 or 14 tell you what version of Stata you need to read it? I have yet to experiment.

                        Comment

                        Working...
                        X