Dear all,
I need to import panel data to Stata. I have two files; one file in .DAT format containing the observations or data, and another in .txt containing the variable name and specifications. I made it previously, but I don't find the do file where I introduced the instruction, and now I am struggling to figure out how to incorporate the variables' names and labels into the data file.
I have transformed data from .DAT to .dta using "import delimited":
The resulting .dta file has this aspect:
The .txt file where variables are described has this aspect:
My question:
How can I include the variable names and relationships in the .dta file?
Thank you very much for your help in advance.
Best regards,
I need to import panel data to Stata. I have two files; one file in .DAT format containing the observations or data, and another in .txt containing the variable name and specifications. I made it previously, but I don't find the do file where I introduced the instruction, and now I am struggling to figure out how to incorporate the variables' names and labels into the data file.
I have transformed data from .DAT to .dta using "import delimited":
Code:
import delimited "file1", encoding(UTF-8)
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int v1 byte(v2 v3 v4 v5 v6 v7) int v8 byte(v9 v10 v11) 1 1 1 2 2 2 2 2003 2 4 2 2 . . . . . . . . . . 3 2 2 2 2 2 2 1948 4 4 2 4 . . . . . . . . . . 5 . . . . . . . . . . 6 2 2 2 2 2 2 1973 1 1 1 7 . . . . . . . . . . 8 . . . . . . . . . . 9 2 2 2 . . . . 1 1 1 10 . . . . . . . . . . 11 . . . . . . . . . . 12 . . . . . . . . . . 13 . . . . . . . . . . 14 2 2 2 2 2 2 1957 4 4 4 15 . . . . . . . . . . 16 . . . . . . . . . . 17 . . . . . . . . . . 18 . . . . . . . . . . 19 2 2 2 2 2 2 1973 1 1 4 20 2 2 2 1 1 1 1969 4 4 4 end
The .txt file where variables are described has this aspect:
Code:
1 ORDINAL 1 - 10 2 Activ Year ....... 2007 12 - 17 Year ....... 2008 19 - 24 Year ....... 2009 26 - 31 Year ....... 2010 33 - 38 3 InternRD Year ....... 2007 61 - 66 Year ....... 2008 68 - 73 Year ....... 2009 75 - 80 Year ....... 2010 82 - 87
How can I include the variable names and relationships in the .dta file?
Thank you very much for your help in advance.
Best regards,
Comment