Statalist


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

Re: st: from stata to SAS


From   "Tim Wade" <wadetj@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: from stata to SAS
Date   Thu, 4 Oct 2007 12:38:00 -0400

Joseph, I'm actually not sure if the noquote is necessary or
not--there may be a Proc Import option that will allow them.
Interesting point regarding the commas, I was not aware of that, but
tab delimited files work as well (See below) I am not too familiar
with SAS's Export format so I usually (when I don't have access to
Stat transfer) use a method with Proc Import, or just read in the data
the old fasioned method manually with a data step which is tedious but
good documentation.

proc import datafile="C:\DATA\test.txt"
out=work.test
dbms=TAB
replace;
getnames=yes;
run;


On 10/4/07, Joseph Coveney <jcoveney@bigplanet.com> wrote:
> Tim Wade wrote:
>
> I suggest using SAS proc import, which is very flexible, like this:
>
> . sysuse auto.dta
> (1978 Automobile Data)
>
> . outsheet _all using test.txt, comma replace noquote
>
> proc import datafile="C:\DATA\test.txt"
> out=work.test
> dbms=dlm
> replace;
> delimiter=",";
> getnames=yes;
> run;
>
> --------------------------------------------------------------------------------
>
> I take it that the -noquote- option is mandatory for a direct-to-SAS path
> (as opposed to the Stata-Excel-SAS path that Juzhi was originally trying
> for).  It presupposes that none of Juzhi's variables are string containing
> an imbedded comma in any observation.  I was led to believe that in such
> cases SAS has, er, longstanding known issues
> ( https://stat.ethz.ch/pipermail/r-help/2007-September/141771.html ),
> something about the consequences of Cary being downwind from Redmond.
>
> I haven't followed closely--was there a reason that Juzhi cannot
> use -fdasave-?  An advantage is that variable labels will be conveyed.  A
> disadvantage is the length limit on variable names.
>
> Joseph Coveney
>
>
> *
> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index