Questions tagged [dta]
37 questions
17
votes
2 answers
Efficiently construct Pandas DataFrame from large list of tuples/rows
I've inherited a data file saved in the Stata .dta format. I can load it in with scikits.statsmodels genfromdta() function. This puts my data into a 1-dimensional NumPy array, where each entry is a row of data, stored in a 24-tuple.
In [2]: st_time…

ely
- 74,674
- 34
- 147
- 228
7
votes
1 answer
convert .dat files to either .dta, .shp, .bdf, or .csv
I have downloaded spatial data from the USGS website that comes in a .dat format, which I can't read in textedit either - it just says "../ofr041189it03/vat.adf". I am familiar with STATA, ArcGIS, and GeoDA, so I was hoping to convert it into a…

Mere
- 71
- 1
- 1
- 2
4
votes
2 answers
Importing foreign languages from csv file to Stata
I am using Stata 12. I have encountered the following problems. I am importing a bunch of .csv files to Stata using the insheet command. The datasets may conclude Russian, Croatian, Turkish, etc. I think they are encoded in "UTF-8". In .csv files,…

Ruxuan Ouyang
- 791
- 1
- 8
- 8
3
votes
1 answer
Error in df_parse_dta_file(): Failed to parse C:/Users/folder/data.dta: This version of the file format is not supported
I wanted to read in a .dta file in R in order to convert it to a .csv file. First, I tried to do so by using the foreign package, but it reported:
Error in read.dta(file): not a Stata version 5-12 .dta file
So I tried to do it by using teh haven…

stats19
- 31
- 1
- 3
3
votes
1 answer
I have a .dta file which has variable labels for each variable. Once imported to R, how can I view these labels?
I imported a .dta (Stata file format) into R, but it looks like the variable labels did not get imported along with the variable names.
Using foreign::read.dta, I tried labels(df), but that only gives me the variable names; and str(df$var) is also…

laura bmw
- 41
- 5
3
votes
3 answers
Stata: Subsetting data using criteria stored in other data set
I have a large data set. I have to subset the data set (Big_data) by using values stored in other dta file (Criteria_data). I will show you the problem first:
**Big_data** **Criteria_data**
==================== …

Bill TP
- 1,037
- 2
- 16
- 29
2
votes
0 answers
Loading and reading .dta file in Python
I tried loading a large .dta file into Python (I used JupyterLab and Google Colab) with the following code:
"data = pd.read_stata('qog_std_ts_jan21.dta')"
OR
data = pd.read_stata('filename.dta', chunksize=100000)
and I get the following…

Ruxandra
- 21
- 1
2
votes
3 answers
Is there a way to save value labels for Stata categorical data within Python?
So I know it's possible to read in either Stata categorical labels or values using the convert_categoricals parameter.
I was looking for a way to write/export a pandas dataframe to Stata and include the value labels. However all I could find was…

Andrei
- 29
- 6
2
votes
1 answer
I have old .DTA Files and .DDF Files... now what?
First time poster here, so be gentle...
I am completely stuck, I have been given the task of importing some old .DTA files into tables in SSMS so we can run queries off of them. Being brand new to .dta formats, I did some digging and this is the…

MichelleSQL
- 21
- 2
2
votes
2 answers
How to measure the performance of the Azure SQL DB?
I need to measure the SQL Azure DB performance using DTA, is it possible or not, if not what is the workaround to consume a workload file (.trc)??

Ⲁⲅⲅⲉⲗⲟⲥ
- 608
- 1
- 8
- 31
2
votes
0 answers
DTA - Error while tuning using a Test Server
I have 2 servers, both have SQL Server 2016 Developer edition installed. I want to tuning the production server using a test server, a method described here - Reducing the Production Server Tuning Load.
Basically it uses the Test Server to Tune the…

Deepan
- 95
- 7
2
votes
1 answer
Reading haven created dta file in Stata - how to deal with dots in variable names?
We are working in Stata with data created in R, that have been exported using haven package. We stumbled upon an issue with variables that have a dot in the name. To replicate the problem, some minimal R code:
library("haven")
var.1 <-…

radek
- 7,240
- 8
- 58
- 83
2
votes
2 answers
Convert .CSV files to .DTA files in Python
I'm looking to automate the process of converting many .CSV files into .DTA files via Python. .DTA files is the filetype that is handled by the Stata Statistics language.
I have not been able to find a way to go about doing this, however.
The R…

Parseltongue
- 11,157
- 30
- 95
- 160
2
votes
1 answer
Proper phrasing for a loop to convert all .dta files to .csv in a directory
So I have a single instance of dta to csv conversion, and I need to repeat it for all files in a directory. Great help on SO, but I'm still not quite there. Here's the single instance
#Load Foreign Library
library(foreign)
## Set working…

anjarp
- 67
- 1
- 6
1
vote
1 answer
Unable to open .dta files because of version
Version of given Stata file is 44. pandas supports importing versions 105, 108, 111 (Stata 7SE), 113 (Stata 8/9), 114 (Stata 10/11), 115 (Stata 12), 117 (Stata 13), 118 (Stata 14/15/16),and 119 (Stata 15/16, over 32,767 variables).
import pandas as…

1729-Shivam-Maurya
- 15
- 6