[prev in list] [next in list] [prev in thread] [next in thread]
List: sas-l
Subject: Re: proc fcmp sql means as additional record on sas dataset
From: Fried Egg <friedegg2012 () GMAIL ! COM>
Date: 2012-06-28 19:33:11
Message-ID: CANS8eEhyPVhX8eUDg3AZjoWqSeZaSS4YD_H1W6EJSPz129HBTA () mail ! gmail ! com
[Download RAW message or body]
Also,
In your provided example you want to calculate the inverse of a matrix, you
can do this in PROC FCMP as follows:
proc fcmp outlib=work.func.matrix;
/* wrapper for FCMP Procedure Special Maxtix CALL Routine INV
INV CALL Routine
calculates a matrix that is the inverse of the provided input matrix
that should be a square, non-singular matrix.
*/
subroutine minv ( in[*,*] , out[*,*] );
outargs out;
call inv(in,out);
endsub;
/* other Matrix CALL Routines here:
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a003193719.htm
*/
quit;
options cmplib=work.func;
data _null_;
array mat[2,2] _temporary_ (1.3,1.6,1.1,1.9);
array inv[2,2] _temporary_;
call minv(mat,inv);
put inv[1,1] inv[1,2] /
inv[2,1] inv[2,2];
run;
On Thu, Jun 28, 2012 at 1:18 PM, Fried Egg <friedegg2012@gmail.com> wrote:
> You should probably invest the time in SAS/IML since it is pretty much
> fully integrated with R, see here for more information:
>
>
> http://support.sas.com/documentation/cdl/en/imlsstat/63545/HTML/default/viewer.htm#statr_toc.htm
>
>
> When using the JAVA object make sure you are using the correct variable
> call type when attempting to retrieve data back to your datastep.
>
>
> PROC FCMP cannot declare data step component objects, so it cannot
> interact with JAVA so your intended interface with this approach would not
> be possible, currently. The have added support in 9.3 to PROC FCMP to call
> hash methods, I believe, but you still cannot declare new hash objects last
> I heard.
>
> I mean I guess you could have a function that runs a macro that runs a
> data step that runs a java object routine that runs a routine in r that
> returns a value to java that returns a macro variable that returns to the
> function, but god-oh-god why?
>
> Using SAS Integration Techologies you could setup something like SAS <->
> JAVA <-> R where JAVA is really doing the integrating through both
> technologies.
>
> There are many ways to approach any problem, but with the goal being: I
> want to integrate R packages and functions into my SAS programs SAS/IML
> provides a perfectly simple means for doing so. My 2 cents...
>
>
> On Thu, Jun 28, 2012 at 12:46 PM, Roger DeAngelis <
> rogerjdeangelis@gmail.com> wrote:
>
>> Hi Fried Egg,
>>
>> Great example. Thanks.
>>
>> R has a nice low level interface with JAVA. I did try to use the SAS
>> JAVA obj to pass a datastep array to JAVA and then to R and I believe I
>> was
>> able to get the array to R. But I was unable to get anthing back from
>> JAVA/R.
>>
>> What I tried to do was use SAS datastep->JAVA->R->JAVA->SAS Datastep. But
>> I could not get it to work.
>>
>> My goal was to wrap all this into a separate FCMP address space
>> subroutine, the java stuff was pretty ugly. All the user would see is:
>>
>> data inverse;
>> array mat[2,2] (1.3,1.6,1.1,1.9);
>> array inv[2,2] ;
>> call inv(mat,inv);
>> run;
>>
>> If R could create a SAS dataset I think I could do the following with
>> FCMP.
>> Note R can read a binary SAS7BDAT.
>> data inverse;
>> set mat inv open=defer;
>> call inverse(mat,inv);
>> /* should be able to operate on the inverse in here */
>> run;
>>
>> Years ago - From Richard DeVenezia
>> /* T002320 CALLING JAVA FROM SAS TO CONCATENATE TWO STRINGS */
>> data _null_;
>> length s_out $200;
>> first='ABCDE';
>> second='FGHIJ';
>> declare JavaObj j1 ('java/lang/String',first);
>> declare JavaObj j2 ('java/lang/String',second);
>> j1.callStringMethod ('concat', j2, s_out);
>> put s_out=;
>> j1.delete(); j2.delete();
>> run;
>>
>> log should have
>> S_OUT=ABCDEFGHIJ
>>
>>
>> I have wasted to much time already on SAS/IML, R is much more powerful.
>>
>
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic