Statalist


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

Re: st: -usesas- and formats


From   "Clinton Thompson" <[email protected]>
To   [email protected]
Subject   Re: st: -usesas- and formats
Date   Thu, 23 Aug 2007 14:00:28 -0400

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 <[email protected]> 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
> [email protected]
>
> Clinton Thompson <[email protected]> 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/



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