[R] R and SAS proc format

Frank E Harrell Jr f.harrell at vanderbilt.edu
Tue Mar 6 22:36:00 CET 2007


Ulrike Grömping wrote:
> The down side to R's factor solution: 
> The numerical values of factors are always 1 to number of levels. Thus, it
> can be tough and requires great care to work with studies that have both
> numerical values different from this and value labels. This situation is
> currently not well-supported by R.

You can add an attribute to a variable.  In the sas.get function in the 
Hmisc package for example, when importing SAS variables that have PROC 
FORMAT value labels, an attribute 'sas.codes' keeps the original codes; 
these can be retrieved using sas.codes(variable name).  This could be 
done outside the SAS import context also.

Frank

> 
> Regards, Ulrike
> 
> P.S.: I fully agree with Frank regarding the annoyance one sometimes
> encounters with formats in SAS! 
> 
> 
> lamack lamack wrote:
>> Dear all, Is there an R equivalent to SAS's proc format?
>>
>> Best regards
>>
>> J. Lamack
>>
>> _________________________________________________________________
>> O Windows Live Spaces é seu espaço na internet com fotos (500 por mês),
>> blog 
>> e agora com rede social http://spaces.live.com/
>>
>> ______________________________________________
>> R-help at stat.math.ethz.ch 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.
>>
>>
> 


-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University



More information about the R-help mailing list