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

Re: st: How to read SAS data into Stata directly?


From   Daniel Egan <[email protected]>
To   [email protected]
Subject   Re: st: How to read SAS data into Stata directly?
Date   Wed, 27 Oct 2004 22:27:13 -0400

Hi Dave, 
First, search the statalist archives
<http://www.stata.com/statalist/archive/> using these strings:
SAS 
StatTransfer
Blanchette
and you should get a nice discussion that has run the past couple of days. 

Among your options: 
1) Export into CSV file from SAS, then insheet/infile into Stata. 
2) Download -usesas- from SAS MASTER Dan Blanchette - see 
http://www.cpc.unc.edu/services/computer/presentations/sas_to_stata/ 
to get his uber-nifty package. 

Thus Spoke Dan:<quote> 
It uses a SAS macro I wrote called SAVASTATA that writes out your
SAS data as a flat ASCII columnar file and then writes the Stata dictionary
file to input that file.  You could read in the SAS data file in parts if you
want using the _in_ option:

. usesas using "d:\project\MyBigHonkingFile.sas7bdat", in(1/1000000)

This would read only the first million obs.

The SAVASTATA macro figures out the minimum data type required to store your
Stata variables so it will be as compressed as the -compress- command
would make it. Unfortunately, it takes time for SAVASTATA to figure
out what the minimum storage type would be for such a large dataset.

-usesas- also figures out how much memory would be required for Stata
to load the dataset if the memory setting is lower than needed.
<end quote>

That package makes the load of transfering  between SAS and Stata
unbearably light. I don't have any advice if you don't have SAS on
your machine.

Good luck, 

Dan


On Wed, 27 Oct 2004 20:51:46 -0500, David Han <[email protected]> wrote:
> Hi, all,
> Does anyone know whether there is some command to read SAS data into
> Stata directly without bothering to use file format conversion
> program, such as Stat/Transfer or DBMS/Copy?
> 
> Thanks
> 
> Dave
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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