I have to apologize to all of you, it appears Alessandro Secchi was right.
When I first tested is solution I had forgotten to sort the data properly
for dpd and got strange results, after which point I only used the sum
stat from dpd.info to test load(), which was obviously the wrong way to
go. Hence, here is what I have learned after doing a formal test for each
and sorting the data properly. Ox reads Stata data in both version 6 and
older format, and it can handle both of them with or without missing
values, but as Alessandro pointed out, the summary statistics from
dpd.info will only be right if there are no missing values.
Sorry, and thanks for your help.
g
********** Please do not reply to this address **********
******** use [log in to unmask] ********
************************ Thank you **********************
On Mon, 14 Feb 2000, Christopher F. Baum wrote:
> Bill,
> I think my conjecture about reading Stata v5 vs Stata v6 is probably
> incorrect. Using just Database::Load, as you were doing, it seems to get
> the right values when a variable has zero missing values, and messes up
> badly if there are mv's. You might try working with a set of variables that
> have no mv's and see if that clears up the problem.
>
> Kit Baum
> Boston College Economics
>
> --On Mon, Feb 14, 2000 9:04 -0500 Bill Frechete <[log in to unmask]> wrote:
>
> > I have tried both Load("filename") and LoadDta("filename", 1, 1, 1) and
> > they give me the same result. What I find really strange is that I have
> > used Load() in the past to load Stata data, and I never noticed any
> > problems, although I think I had at that time the previous version of Ox
> > and DPD. I have tried re-installing Ox on my new computer to no avail. Any
> > other suggestions?
> >
> > BTW, I have a more general question about etiquette. When I respond to an
> > answer that was given to one of my questions in such a users discussion
> > list, should I only send my response to the discussion list, or also
> > directly to the author of the answer?
> >
> > Thanks in advance,
> >
> > g
> >
> > ********** Please do not reply to this address **********
> > ******** use [log in to unmask] ********
> > ************************ Thank you **********************
> >
> > On Fri, 11 Feb 2000, Christopher F. Baum wrote:
> >
> >> http://www.nuff.ox.ac.uk/Users/Doornik/doc/ox/oxclass.htm#Database::Load
> >>
> >> says
> >>
> >> "LoadDta creates the database and loads the specified Stata (version
> >> 4--6) data file from disk."
> >>
> >> Might it be that Load() is the wrong function? Or does it figure it out?
> >> The calling sequence for LoadDta is longer than that for Load, as that
> >> URL shows.
> >>
> >> Kit Baum
> >>
> >> --On Fri, Feb 11, 2000 10:20 -0500 Bill Frechete <[log in to unmask]>
> >> wrote:
> >>
> >> > I am simply trying to load data from stata and although it does load
> >> > the data, there are missing observations. Here is the program:
> >> >
> >> > #include <oxstd.h>
> >> > #import <packages/dpd/dpd>
> >> > #import <database>
> >> >
> >> > main()
> >> > { decl dpd = new DPD(), time = timer(), x;
> >> >
> >> > dpd.Load("c:/corruption/data/stata/corr_causesox.dta"); // load
> >> > data
> >> > dpd.SetYear("year"); //
> >> > specify years
> >> > dpd.SetIndex("id");
> >> > // specify countries
> >> >
> >> > dpd.Info();
> >> > // print sum stat
> >> >
> >> > delete dpd;
> >> > }
> >> >
> >> > Here is the output:
> >> >
> >> > Ox version 2.10 (Windows) (C) J.A. Doornik, 1994-99
> >> > This version may be used for academic research and teaching only
> >> > DPD package version 1.0, object created on 11-02-2000
> >> >
> >> >
> >> > ---- Database information ----
> >> > 14 variables, 2130 observations
> >> >
> >> > name sample period min mean max stddev
> >> > year 1 (1) 2130 (1) 82 89.657 97 4.3933
> >> > y 1 (1) 83 (1) 9.695 13.609 18.547 1.4934
> >> > pop 1 (1) 2035 (1) 11.923 16.059 20.928 1.6106
> >> > ss 2 (1) 14 (1) 90.2 106.85 136.5 11.837
> >> > area 1 (1) 171 (1) 10.625 11.955 13.399
> >> > 0.88241 corr 1 (1) 2130 (1) -10 -5.6758 0
> >> > 2.3744 pol 1 (1) 82 (1) 1 1.061 2
> >> > 0.23929 civil 1 (1) 82 (1) 1 1.0854 2
> >> > 0.27943 dist 1 (1) 3 (1) 2.969 2.969 2.969
> >> > 0 id 1 (1) 2130 (1) 1 74.722 149
> >> > 42.685 family 1 (1) 2035 (1) 1 3.9671 5
> >> > 0.9816 import 1 (1) 38 (1) 0.17884 0.24781 0.31035
> >> > 0.030418 export 2 (1) 7 (1) 0.039135 0.12161
> >> > 0.41902 0.13368 partnery 4 (1) 12 (1) 11.726 13.255
> >> > 14.128 0.68605
> >> >
> >> > If I ask STATA to summarize the data, her is what I get:
> >> >
> >> > Variable | Obs Mean Std. Dev. Min Max
> >> > ---------+-----------------------------------------------------
> >> > year | 2130 89.65681 4.394375 82 97
> >> > y | 1769 5.297616 5.062108 .197 24.322
> >> > pop | 2093 16.06303 1.59084 11.92251 20.92798
> >> > ss | 1551 60.15261 32.07468 3 148.3
> >> > area | 1993 11.24692 1.636897 5.806339 13.79322
> >> > corr | 2130 -5.675822 2.374974 -10 0
> >> > pol | 1714 3.750875 2.199164 1 7
> >> > civil | 1714 3.867561 1.915454 1 7
> >> > dist | 1334 5.922201 2.420195 1.267 11.518
> >> > id | 2130 74.72207 42.69479 1 149
> >> > family | 2035 3.967076 .9818395 1 5
> >> > import | 1347 .3028844 .2457959 .0288647 2.007614
> >> > export | 1205 .1935729 .2871115 .0002192 2.774533
> >> > partnery | 1557 14.02016 4.420062 .936 20.049
> >> >
> >> > Clearly, these are not the same. Does somebody know what's going on?
> >> >
> >> > Thanks in advance
> >> >
> >> > g
> >> >
> >> > ********** Please do not reply to this address **********
> >> > ******** use [log in to unmask] ********
> >> > ************************ Thank you **********************
> >> >
> >>
> >>
> >>
> >> -----------------------------------------------------------------
> >> Kit Baum [log in to unmask] http://fmwww.bc.edu/ec-v/baum.fac.html
> >>
> >
> >
>
>
>
> -----------------------------------------------------------------
> Kit Baum [log in to unmask] http://fmwww.bc.edu/ec-v/baum.fac.html
>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|