Statistical programming, matrix languages, and more

Not Able To Invoke R from PROC IML

Reply
New Contributor
Posts: 4

Not Able To Invoke R from PROC IML

Hi,

I currently have version SAS 9.2 TS Level 2M3 and R 2.11.1 version installed on my local system running Windows XP 32 bit version. I have changed the configuration file "C:\Program Files\SAS92\SASFoundation\9.2\nls\en\SASV9.CFG" to include the -RLANG option.

After I start SAS and run the below snippet of code,

PROC OPTIONS OPTION=RLANG;

RUN;

I do get the message in the log "RLANG Support access to R language interfaces".

But when I run the below sample code

PROC IML;

SUBMIT / R;

a <- 2

paste("a:",a)

b <- 3

paste("b:",b)

c <- a * b

paste("c:",c)

ENDSUBMIT;

QUIT;

I get the below error message in the log.

33   PROC IML;
NOTE: IML Ready
34   SUBMIT / R;
     ------
     180
ERROR 180-322: Statement is not valid or it is used out of proper order.

35   a <- 2
     -
     180
ERROR 180-322: Statement is not valid or it is used out of proper order.

36   paste("a:",a)
37   b <- 3
38   paste("b:",b)
39   c <- a * b
40   paste("c:",c)
41   ENDSUBMIT;
42   QUIT;
NOTE: Exiting IML.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IML used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds

Appreciate any insight on how to fix this installation issue. Are there any other environmental variables that would need to be set?

Thanks,

Vikram

Esteemed Advisor
Posts: 7,302

Re: Not Able To Invoke R from PROC IML

New Contributor
Posts: 4

Re: Not Able To Invoke R from PROC IML

Yes it is installed at "C:\Program Files\R\R-2.11.1".

Esteemed Advisor
Posts: 7,302

Re: Not Able To Invoke R from PROC IML

and is that the 32 or 64 bit version?  I ask because I think that only the 32 bit version is supported.

New Contributor
Posts: 4

Re: Not Able To Invoke R from PROC IML

@Arthur: Its the 32 bit version that was installed.

@Rick: I ran the code that you sent and got the message "ERROR: Invocation of unresolved module CUPROD.". How can I check which version of SAS/IML I have? Is there a hotfix to upgrade the SAS/IML version? Appreciate your insight.

46   proc iml;

NOTE: IML Ready

47   c = cuprod(1:5);

ERROR: Invocation of unresolved module CUPROD.

statement : ASSIGN at line 47 column 1

48   quit;

NOTE: Exiting IML.

NOTE: The SAS System stopped processing this step because of errors.

NOTE: PROCEDURE IML used (Total process time):

      real time           0.01 seconds

      cpu time            0.01 seconds

SAS Super FREQ
Posts: 3,420

Re: Not Able To Invoke R from PROC IML

I don't think that you have the version of SAS/IML that supports the SUBMIT statement.

Try this

proc iml;

c = cuprod(1:5);

If SAS/IML complains that the CUPROD function is not found, then you do not have the correct version of SAS/IML.

There were actually two different SAS releases that together rolled out the 9.22 functionality.  SAS/IML was in the second release. If memory serves, the SAS/IML release was somewhere around the end of September 2010.

SAS Super FREQ
Posts: 3,420

Re: Not Able To Invoke R from PROC IML

As I suspected, you do not have SAS/IML 9.22. You have just regular 9.2.

A hotfix only fixes a bug in a current version of SAS, so it is not applicable here. To get new features, talk to your SAS administrator about updating to a newer version of SAS, such as 9.3M2 (which the analytical products call 12.1).

Perhaps SAS/IML can solve your problem directly. What problem are you rtying to solve?

New Contributor
Posts: 4

Re: Not Able To Invoke R from PROC IML

Thanks Rick. One of my team members here at Kaiser Permanente is reviewing some R code written in a research paper and wanted to incorporate it into his own current data research project. I am just trying to help him explore if we can call the R code within SAS instead of re-writing in PROC IML. Appreciate your help.

Ask a Question
Discussion stats
  • 7 replies
  • 922 views
  • 1 like
  • 3 in conversation