[R] Ever see a stata import problem like this?
John Hendrickx
john_hendrickx at yahoo.com
Wed Sep 22 11:00:29 CEST 2004
I've had a similar problem once. What may have caused the problem
then was a variate for which value lables had been defined for the
highest and lowest values. What complicates things is that the file
had been originally converted from SPSS to Stata. A workaround was to
set "convert.factor=FALSE" and that seems to work here too (using R
1.91 and the latest update for foreign):
> m2<-read.dta("morgen.dta",convert.factors=FALSE)
> summary(m2)
CASEID year id hrs1
Min. : 19721 Min. :1972 Min. : 1 Min. : 0.00
1st Qu.: 1983475 1st Qu.:1978 1st Qu.: 445 1st Qu.: 37.00
Median : 1996808 Median :1987 Median : 905 Median : 40.00
Mean : 9963040 Mean :1986 Mean : 990 Mean : 41.05
3rd Qu.:19872187 3rd Qu.:1994 3rd Qu.:1358 3rd Qu.: 48.00
Max. :20002817 Max. :2000 Max. :3247 Max. : 89.00
NA's :17654.00
hrs2 prestige agewed age
Min. : 0.00 Min. : 12.00 Min. : 12.00 Min. :
18.00
1st Qu.: 38.00 1st Qu.: 30.00 1st Qu.: 19.00 1st Qu.:
30.00
Median : 40.00 Median : 39.00 Median : 21.00 Median :
42.00
Mean : 39.79 Mean : 39.36 Mean : 22.10 Mean :
45.15
3rd Qu.: 45.00 3rd Qu.: 48.00 3rd Qu.: 24.00 3rd Qu.:
58.00
Max. : 89.00 Max. : 82.00 Max. : 73.00 Max. :
89.00
NA's :40159.00 NA's :16666.00 NA's :15551.00 NA's
:143.00
educ paeduc maeduc speduc
Min. : 0.00 Min. : 0.00 Min. : 0.00 Min. :
0.00
1st Qu.: 11.00 1st Qu.: 8.00 1st Qu.: 8.00 1st Qu.:
12.00
Median : 12.00 Median : 11.00 Median : 12.00 Median :
12.00
Mean : 12.48 Mean : 10.21 Mean : 10.41 Mean :
12.53
3rd Qu.: 14.00 3rd Qu.: 12.00 3rd Qu.: 12.00 3rd Qu.:
14.00
Max. : 20.00 Max. : 20.00 Max. : 20.00 Max. :
20.00
NA's :127.00 NA's :11586.00 NA's :6782.00 NA's
:18153.00
income
Min. : 1.000
1st Qu.: 9.000
Median : 11.000
Mean : 9.756
3rd Qu.: 12.000
Max. : 13.000
NA's :3453.000
>
--- Paul Johnson <pauljohn at ku.edu> wrote:
> Greetings Everybody:
>
> I generated a 1.2MB dta file based on the general social survey
> with
> Stata8 for linux. The file can be re-opened with Stata, but when I
> bring
> it into R, it says all the values are missing for most of the
> variables.
>
> This dataset is called "morgen.dta" and I dropped a copy online in
> case
> you are interested
>
> http://www.ku.edu/~pauljohn/R/morgen.dta
>
[snip]
More information about the R-help
mailing list