Reputation: 11
When I call R from Proc IML, it reports an ERROR: SAS is unable to transcode character data to the R encoding
I submit this line of code : %put %sysfunc(getoption(encoding));
the result is UTF-8
> Sys.getlocale()
[1] "LC_COLLATE=Chinese (Simplified)_China.936;LC_CTYPE=Chinese
(Simplified)_China.936;LC_MONETARY=Chinese (Simplified)_China.936;LC_NUMERIC=C;LC_TIME=C"
The following is the example codes from SAS document: proc options option=rlang; run;
RLANG Enables SAS to execute R language statements.
NOTE: PROCEDURE OPTIONS used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
option set=R_HOME='C:\Program Files\R\R-4.0.2';
proc iml;
x = 1:3;
/* vector of sequence 1,2,3 */
m = {1 2 3, 4 5 6, 7 8 9};
/* 3 x 3 matrix */
q = m * t(x);
/* matrix multiplication */
submit / R;
rx <- matrix( 1:3, nrow=1) # vector of sequence 1,2,3
rm <- matrix( 1:9, nrow=3, byrow=TRUE) # 3 x 3 matrix
rq <- rm %*% t(rx) # matrix multiplication
endsubmit;
quit;
Upvotes: 1
Views: 492
Reputation: 11
I got the same error message. The R version 4.0.3
was not compatible with the SAS ver 9.4
that I was running on a windows 1
0.
https://blogs.sas.com/content/iml/2013/09/16/what-versions-of-r-are-supported-by-sas.html
The problem was resolved with R version 3.6.3
. Included the following code to point to the compatible version of R.
options set=R_HOME='C:\Program Files\R\R-3.6.3';
Upvotes: 1