Question

I need to submit R statements in SAS. To do that, the SAS documentation recommand to enable the RLANG option (which I did) and then use the submit statement as follows :

submit / R;

(more details are available here, I use the exact example code.)

My issue is that the submit statement is not recognized : it appears in red in the editor and if I try to run the code anyway, I get the following error :

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

I have the same issue if I try to use submit in another context. Any ideas how to fix this ?

Was it helpful?

Solution

The submit statement is a feature of the SAS/IML language, so it must be submitted during a SAS/IML code block.

proc iml;
 submit / R;
    x <- 5
    x

  endsubmit;
quit;

Further, you must have the RLANG system option set (which may be controlled by you or your administrator) at system startup.

For more information see the SAS documentation.

In addition, you need to have SAS/IML version 9.22 to use R. This comes with some installations of SAS 9.2 TS3M2, but having that release is not a guarantee of having the functionality available. Per this question on SAS Communities, Rick Wicklin suggests testing with this code:

proc iml;
c = cuprod(1:5);

If that does not work, then you do not have SAS/IML 9.22 and thus cannot use submit to R.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top