Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Stata v. SAS OLS

From   "Eric G. Wruck" <>
Subject   Re: st: Stata v. SAS OLS
Date   Fri, 22 Apr 2005 09:47:44 -0400

If you have Stat Transfer available, you could run the following experiment:

--  transfer your SAS data set to Stata & run the regression in Stata

--  transfer your Ststa data set to SAS & run the regression in SAS

I would think this would reveal something. 


>I am having some trouble trying to match OLS regression output done in
>SAS to a OLS regression done in STATA.  Basically, I was given a SAS
>program, and when run on SAS, it produces the exact results we are
>looking for.  However, I'm trying to "convert" it into a STATA program.
>The program itself appends and merges a number of datasets, creates some
>variables from the final merged dataset using some simple arithmetic
>commands, drops certain observations, and then runs a OLS regression on
>certain variables.  It is really not all that complex of a program, but
>I cannot for the life of me get my STATA regression results to match the
>SAS results.  This is made even more bizarre by how similar the final
>datasets appear to be.  All of the summary statistics (i.e. mean, std.
>Dev., max, min, number of observations) are identical in both programs.
>Moreover, I generated an "id" variable that simply numbers the
>observations in the first (and largest dataset) in both programs, and
>after all the datasets are merged and transformed, both datasets contain
>the exact same observations from that first dataset (e.g. the id
>variables from both programs are identical).  When I run the regressions
>in STATA, the coefficients for the variables all come very, very close,
>if not exactly the same as the coefficients in SAS.  The only exception
>to this is the constant, which bizarrely is nearly 100 times larger than
>the constant in SAS.  And I cannot figure out why!  Does anyone know
>what would cause supposedly identical datasets to produce such different
>results in the constants?  I have a pocket theory that it is because the
>programs treat blanks and zeros differently, but I have been unable to
>prove it, and the problem could very well be something else.  If anyone
>can offer any help, I would greatly appreciate it! 



       Eric G. Wruck
       2535 Sherwood Road
       Columbus, OH  43209

       ph:      614.231.5034
       cell:    614.327.4182
       fax:     614.231.5039
       eFax:    614.573.6639

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index