[R] SAS Proc summary/means as a R function

schuster mail at friedrich-schuster.de
Tue Jul 13 19:38:04 CEST 2010


Hello, 

are you trying to pase SAS code (or lightly modified SAS code) and run it in R? 

Then you are right: the hard part is parsing the code. I don't believe that's 
possible without a custom parser, and even then it's really hard to parse all 
the SAS "sub languages" right: data step, macro code and macro variables, IML, 
SAS Procedures etc. 



On Tuesday 13 July 2010 02:39:22 pm Roger Deangelis wrote:
> Thanks Richard and Erik,
> 
> I hate to buy the book and not find the solution to the following:
> 
> proc.means <- function(....) {
>    deparse(match.call()[-1])
> }
> 
> proc.means(this is a sentence)
> 
> unexpected symbol in   "proc means(this is)
> 
> One possible solution would be to 'peek' into the memory buffer that holds
> the
> function arguments.
> 
> It is easy to replicate the 'dataset' output for many SAS procs(ie
> transpose, freq, summary, means...)
> I am not interested in 'report writing in R'.
> 
> The hard part is parsing the SAS syntax, I wish R had a drop down to PERL.
> 
> per1 on;
> 
>    some perl code
> 
> perl off;
> 
> also
> 
> sas on;
> 
>   some SAS code
> 
> sas off;
> 
> The purpose of parmbuff is to turn off of Rs scanning and resolution of
> function arguments
> and just provide the bare text between '('  and ')' in the function call.
> 
> This is a very powerful construct.
> 
> A function would provide something like
> 
> sas.on(
> 
> 
> )
> 

-- 
----
Friedrich Schuster
Dompfaffenweg 6
69123 Heidelberg



More information about the R-help mailing list