Statalist


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

Re: st: -usesas- and formats


From   "Anders Alexandersson" <andersalex@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: -usesas- and formats
Date   Thu, 23 Aug 2007 14:50:17 -0400

Here are two suggestions to try:
First, remove the underscore on one offending SAS format and try to
convert that format only (or do it for all formats in a text editor
and try again). If the conversion to Stata now works, you found a
limitation of -usesas- and a workaround. Second, make sure that you
have an updated version of of -usesas-. In May 2006 I identified a
problem with value labels for SAS special missing (Stata extended
missing) values, which Dan quickly solved.

Anders Alexandersson
andersalex@gmail.com


On 8/23/07, Clinton Thompson <clintonjthompson@gmail.com> wrote:
> One SAS format not transferred (among many) is the following:
>
>  VALUE _AGE65YR
>             .D                  =    'DK/NS'
>             .R                  =    'REFUSED'
>             1                   =    'Age 18 to 64'
>             2                   =    'Age 65 or older'
>             3                   =    'Do not know/Refused/Missing'
>
> Note that, following a cursory review of which formats are not
> transferred, most (perhaps all?) of the offending formats begin w/ an
> underscore (as the one above).  Also note that even though many of the
> formats are transferred and are identifiable via -label dir-, they are
> still not appended to the appropriate variable.  And parenthetically,
> the syntax I used to transfer the SAS file to Stata follows:
>
> usesas using "pathname of SAS file", formats
>
> where there is a FORMAT file in the *same* directory as the SAS file
> named "formats.sas7bcat" (per the requirements from the -usesas- help
> file).
>
> Thanks again!
> --Clint
>
>
> On 8/23/07, Anders Alexandersson <andersalex@gmail.com> wrote:
> > Please give an example of a SAS format not converted to a value label
> > in Stata. Note that Stata does not allow value-label ranges or string
> > variables with value labels.
> >
> > Anders Alexandersson
> > andersalex@gmail.com
> >
> > Clinton Thompson <clintonjthompson@gmail.com> wrote:
> > > Hello All:
> > > I'm using Dan Blanchette's -usesas- program to import a moderate size
> > > SAS file (211 variables, ~3800 observations) into Stata and although
> > > it works correctly --- at least insofar as reading all variables and
> > > observations --- it does *not* append the variable value formats to
> > > the respective variables (problematic since almost every variable
> > > includes a format).  After the data is loaded into Stata, however, I
> > > can type -label dir-, which returns most but not *all* of the formats
> > > housed in the SAS file, "formats.sas7bcat", and I suppose I could
> > > invoke a series of -label values- commands, but given 200+ variables,
> > > this seems rather cumbersome and inefficient (not to mention, all the
> > > formats are not imported!).  I've read, reread, and read again the
> > > help file for -usesas- and even changed the path name of the two SAS
> > > macros in the sasexe.ado file to the location of my sas.exe file, but
> > > to no avail (at least w/ respect to properly importing the formats.).
> > > I'm using Stata/SE 9.2 for Windows and SAS, v.8.
> > > Any suggestions?  Thoughts?
> > *
> > *   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/
>
*
*   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