[R] How to import SAS file defining codes by SAS format catalog file
peter dalgaard
pdalgd at gmail.com
Sat Mar 22 10:52:43 CET 2014
Also, once you are working in R, you need to familiarize yourself with the concept of a factor object. These are used to represent categories in R. Unlike SAS, R considers the categorical/quantitative distinction as part of the variable, e.g. in modeling you don't use CLASS directives, you ensure that the variable is a factor. You create factors from numerical codes with factor(), and in the process you may attach meaningful labels to the factor levels.
(There's a whole book by Robert Muenchen designed to ease the transition from SAS to R.)
-pd
On 21 Mar 2014, at 10:06 , David Winsemius <dwinsemius at comcast.net> wrote:
>
> On Mar 21, 2014, at 12:57 AM, Kei_Takeuchi wrote:
>
>> Dear Sir/Madam,
>>
>> Hello, this is Kei Takeuchi in Japan Automobile Research Institute.
>>
>> I am using R to import SAS file in NHTSA. This is happening since SAS is
>> too expensive software.
>>
>> I successfully imoported SAS file which is *****.sas7bdat by R.
>>
>> Now I want to define codes in SAS file like 1 to Alabama. Now all the
>> data in SAS file is codes(for example 1,2,3...) which is hard to see. I
>> use code book(published in UMTRI) to see what the codes mean)
>>
>> Defining code to text is possible in SAS where file called formats.
>> sas7bcat.
>>
>>
>> Is it possible by R?
>
>
> You might want to look at the functions in pkg: SAScii
>
> Author: Anthony Joseph Damico [aut, cre]
>
> URL: https://github.com/ajdamico/SAScii
>>
>>
>>
>> Thank you.
>>
>> Sincerely yours,
>> Kei Takeuchi
>>
>>
>> _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
>>
>> Kei Takeuchi
>>
>> Crash Safety
>> Safety Research Division
>>
>> Japan Automobile Research Institute (JARI)
>>
>> Address: 2530 Karima, Tsukuba, Ibaraki 305-0822, Japan
>> TEL: +81-29-856-0885
>> FAX: +81-29-856-1121
>> E-mail: ktake at jari.or.jp
>> HP: http://www.jari.or.jp
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius
> Alameda, CA, USA
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help
mailing list