Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: from stata to SAS


From   juzhi wang <[email protected]>
To   [email protected]
Subject   Re: st: from stata to SAS
Date   Fri, 12 Jan 2007 07:46:21 -0800 (PST)

Hi,

Thank you so much for all of the kind replies. I will try every advice.

Best Regards,
Aihua

----- Original Message ----
From: "William Gould, Stata" <[email protected]>
To: [email protected]
Sent: Friday, January 12, 2007 9:33:26 AM
Subject: Re: st: from stata to SAS


Juzhi Wang <[email protected]> wrote, 

> [...] I need to import Stata data sets to SAS. What I need to do is to
> export the Stata into Excel and from Excel to SAS.

One easy way to export data from Stata to SAS is using Stata's -fdasave-
command, which will save the dataset in SAS XPORT format.  That will allow
you to skip the Excel step.  For example, 

        . use auto, clear 
          (1978 Automobile Data)


        . fdasave forsas
          the following variable(s) have names that must be changed to fit
          into .xpt format:  (suggested renamings shown):

                    displacement -> DISPLACE
                      gear_ratio -> GEAR_RAT

          specify option rename to save .xpt file with suggested names
        r(110);


        . fdasave forsas, rename
          the following variable(s) were renamed in the output file:

                    displacement -> DISPLACE
                      gear_ratio -> GEAR_RAT

          file forsas.xpt saved
          file formats.xpf saved

Another alternative, as Michael McCulloch <[email protected]> mentioned, is to use
Stat/Transfer, which will allow you to go directly to a SAS format dataset.
Stat/Transfer is available either from www.stattransfer.com or from
www.stata.com.

-- Bill
[email protected]
*
*   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/

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

*
*   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