[R] things that are difficult/impossible to do in SAS or SPSS but simple in R

Tim Churches tchur at optushome.com.au
Fri Jan 18 01:43:09 CET 2008


James Reilly wrote:
>> Max Kuhn wrote:
>>> Factors have huge benefits over character data in SAS. For a series
>>> regulatory filings, I had miles of SAS code to compute KxK tables
>>> where all the cells must show up. For example, if one of the levels of
>>> one of the variables was never observed, the corresponding row or
>>> column would not show up in proc freq. The basic way around this was
>>> to get all possible combinations of the variables and assign each cell
>>> to have a row count of 0.00000001. Then you would merge this data with
>>> the real counts. The missing row/columns would show up since they had
>>> data, but it was below the printing threshold of proc freq. Hoepfully,
>>> they have added a feature to do this.
>>>   
> On 18/1/08 4:44 AM, Peter Dalgaard wrote:
>> I could have sworn that this was a fluke and that it would work if you
>> put a user-defined format on the classification variable, but no go....
>> I can't find anything that does this, neither in PROC FREQ nor PROC
>> TABULATE.
> 
> I believe the CLASSDATA option in PROC TABULATE lets you specify which 
> values will show up in the table, including unobserved values.
> 
> http://support.sas.com/onlinedoc/913/getDoc/en/proc.hlp/a002473736.htm#a003069171
> 
> I'm not aware of any way to do this in PROC FREQ, though.

You can specify the COMPLETETYPES option in PROC MEANS or PROC SUMMARY 
to include output rows for empty cells in a 
cross-classification/crosstabulation - but you won't get a nicely 
formatted table - you'll have to do that yourself, or wrestle with PROC 
TABULATE.

See 
http://support.sas.com/onlinedoc/913/getDoc/en/proc.hlp/a000146729.htm - 
it is a new feature in Version 9.x of SAS, I think?

Tim C




More information about the R-help mailing list