banner



How To Change Dat Files To Dta In Stata

Hello all,

I need to use a .dat file in Stata. I have never used this blazon of file earlier and practise not know how to convert it to a format which Stata can read.

I attached a pdf of what the .dat file looks like in text. I would really appreciate if someone could provide aid on this.

Cheers

Anyone have any ideas on how to solve this problem? I would really appreciate any kind of help!

Hello econlearner,

Although I haven't worked with .dat extensions before, I think I might know a way to deal with your result that may worth a shot.
If you lot right click the file, try opening information technology beginning with Excel. Ideally, the data is already nicely seperated in columns and all you have to do is do a little formatting where necessary before saving information technology as an .xls and importing it in STATA.

If this doesn't work, there might exist some other way, by looking at your .pdf:
1. Open the .dat file in Notepad and save it as a .txt file.
two. Open up Excel (I use 2010), go to the Data tab and select "From text"
3. Select the .txt yous just made
4. In the window that pops up (pace i of the 3 in the wizard), choose the first option, "Delimited"
5. In that same window, brand sure yous let excel start where the first line of your data begins. So avert the titles and other stuff you don't need. And then press 'adjacent'.
6. In the adjacent window you lot'll encounter a preview of your data. One time you choose the right seperator (which is 'space' in the example at hand) and untick any other seperator, the preview will show the data divided in the right columns.
7. Press next and then, washed. Excel should have the data correctly ordered in columns. Again, after some formatting you could save it every bit an .xls and import information technology in STATA.

What's important to mention is that with this procedure, Excel essentially checks the .txt file for spaces and each time it finds ane it creates a new column. Therefore, it'south wise to bank check is that the data yous try to load only includes spaces where in that location should exist a split to the adjacent cavalcade. If the data itself contains spaces (which judging by your .pdf, it does not), this trick won't work.

Good luck,

Mike

RobertoFerrer

I would erase the header and utilise -insheet-.

Example lawmaking for a file like the one attached:

Code:

                        clear all  set more off  insheet using test.dat, delimiter(" ") names  depict  list in ane/ten                      

See -help insheet- and more generally, -help import-.

Source: http://www.talkstats.com/threads/using-dat-file-on-stata.56257/

Posted by: vizcarraounded.blogspot.com

0 Response to "How To Change Dat Files To Dta In Stata"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel