Announcement

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

  • Saver data from .dta to .dat

    Hello,

    I have got some problem in converting my data into .dat format. I used stata2mplus and ntomplus but it seems these packages are producing some error and MPLUS is not able to read the new dataset. Could someone suggest me another way of doing this? Thanks.

  • #2
    Stat/Transfer (which is not freeware) can do it.

    Comment


    • #3
      Try "findit runmplus". Strange you're getting errors with the other packages, though; mplus takes raw ASCII, which isn't all that error prone.

      Comment


      • #4
        Thanks Svend. I got this software and I try to convert the data with the option ASCII fixed format + all programs but it seems that the conversion is not successfull. First I do not have commas to separate my data and second data are disordered. See the first row attached below.

        7247245359 32514231555224111111241111111111111150 3501 60

        Comment


        • #5
          Thanks for the support.
          In STAT/transfer I am using the option ascii fixed format+all program to convert the data, is it correct to read data in MPLUS?
          In the conversion my country and id variables are merged together and sometimes there are some space between them. Do you have any clue about it?
          Does the error could be due for the missing values coding? I am coding them as -9999 and -9996 for the valid skip, because this is the way how MPLUS read them.
          I attach the file.
          Hope you can help with this. Thanks.
          Attached Files

          Comment


          • #6
            Here is an exert of my converted .dat fiile
            Attached Files

            Comment


            • #7
              Ivano, although it is possible that someone here might be able to help you, please keep in mind that this is a discussion forum for Stata, not Stat/Transfer or Mplus. I would recommend that you contact Stat/Transfer tech support.

              Comment


              • #8
                Ivano,

                If you are using Stat Transfer, one of the output formats you can select is MPlus. That's what you should use, not ASCII.

                Alternatively, you can get the ado file runmplus.ado from SSC (-ssc install runmplus-). With runmplus you don't need to create an MPlus data file, nor write an MPlus program. You can use the various options in -runmplus- to tell Stata what data and MPlus commands are needed, and then Stata will create the .dat file and MPlus program for you, pass them on to MPlus, and then capture (or save) MPlus' output in your Stata log file.

                If this is pretty much a one-off and the MPlus program is simple to write, it may not be worth learning to use -runmplus-. But if you use MPlus often and prefer the Stata interface, -runmplus- is well worth it. It is also extremely useful if you have to run batches of parameterized analyses in MPlus: you can use Stata's looping commands to automate the whole process.

                Comment


                • #9
                  Ivano,
                  1. where is the description of the MPlus file format? Note that .dat is file extension, not file format.
                  2. if there is no description, do you have examples of the files accepted by MPlus?
                  3. According to ben earnhart MPlus takes in raw ASCII files, is this the only format it supports?
                  Sergiy

                  Comment


                  • #10
                    According to ben earnhart MPlus takes in raw ASCII files, is this the only format it supports?
                    That is true in the sense that MPlus data files contain plain ASCII text. But there are issues about the representation of missing values and whether to use fixed or delimited formats--which are fairly flexible but have to be consistent with what you specify in the DATA statement in your MPlus code. Details can be found in the MPlus User's guide, which is available as a PDF at https://www.statmodel.com/download/u...Guide%20v6.pdf.

                    Comment


                    • #11
                      Dear Clyde my Stat/transfer edition 8 does not include mplus format as an option.

                      I will go for the runmplus option but when first I used it it seems it deletes the data in .dat format if the dataset exceeds a certain size.

                      Thanks for your help, I really appreciate that.

                      Comment


                      • #12
                        Stat transfer version 8 is very old! I'm a big fan of Stat Transfer and generally run the current version or just one version behind. It's very inexpensive software and their customer service is outstanding. So it might well be worth your while to get the current Stat Transfer. (I have no conflict of interest in recommending it: I have no relationship to Circle Systems other than satisfied customer.) Then again, if you don't do much conversion between data set types, even at its low price it might not be sufficient value for you.

                        With regard to -runmplus-, if you want to save the .dat file it creates you have to specify the saveinputdatafile() option. Otherwise, the file is created as a temporary file and deleted after the run is completed--and as far as I know it has nothing to do with the size of the file.

                        Comment


                        • #13
                          Thanks a lot Clyde. I really appreciate your suggestions.

                          Comment

                          Working...
                          X