BookmarkSubscribeRSS Feed
ea22
Calcite | Level 5

Thank you ALL for your feedback.

 

Another try --- I am trying to run the following code (from Listen Data site).  

 

Both SAS and R are on server and windows verstion (instead of SAS UE on server and R on local machine).

 

setwd() below does not seem to work, nor running R code from SAS.  Any suggestions!!

 

Please see rpath in Proc_R.sas (attached) -- which came from a JSS paper. Inside Proc_R, as suggested, I used rpath=%str(C:\Progra~1\R\R-3.3.2\bin\R.exe

 

%include "C:\test\Proc_R.sas"; 

data example;
input Srl x1-x5;
cards;
1 . 89 85 . 87
2 79 73 74 . .
3 80 82 . 85 .
;
run;

************* EXAMPLE 1 *************;
/*Run Summary Statistics*/
%Proc_R(SAS2R=example, R2SAS=);
cards4;
setwd("C:/test")
summary(example)
;;;;
%quit;

 

proc print data=rlog;
run;

 

2 REPLIES 2
ballardw
Super User

When you say "below does not seem to work" please describe how it doesn't work. Do you get errors or unexpected warning? Post the code with the log that shows the messages. If inside a macro, run the code with OPTIONS MPRINT; turned on. Post the result in a code box using the {i} icon to keep the forum from re-formatting the text.

 

If you get unexpected output describe the expected result and show the actual result.

Nothing?

 

Did you open the generated text file with what I think is supposed to be R code and verify the code written there was as intended?

ea22
Calcite | Level 5

Sorry for the confusion, should have added more details. I used MPRINT, and the text files (which you asked) were not found in the work directory assigned by setwd() statement.

 

The code basically hangs and only way out is Cancel Submitted Statements.  I attached the code with few %put inserted.  

 

Since the previous attempt of attaching the log file did not go through for some reason, below is the log.  Many thanks,

 

251 %include "C:\EA_test\Proc_R.sas";
501
502 data example;
503 input Srl x1-x5;
504 cards;

NOTE: The data set WORK.EXAMPLE has 3 observations and 6 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds


508 ;
509 run;
510 %put "HI 001";
"HI 001"
511
512 /*Run Summary Statistics*/
513 %Proc_R(SAS2R=example,R2SAS=);
MPRINT(PROC_R): options notes;
MPRINT(PROC_R): data _null_;
MPRINT(PROC_R): call symput('r_code','r_code'||trim(left(scan(put(datetime(),best.),1,'.'))));
MPRINT(PROC_R): run;

NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds


r_code1802690920
MPRINT(PROC_R): data _null_;
MPRINT(PROC_R): file "C:\Users\TEF419~1\AppData\Local\Temp\SAS Temporary
Files\_TD2256_WINDOWS7STATIC2_\r_code1802690920.r";
MPRINT(PROC_R): infile cards4;
MPRINT(PROC_R): input;
MPRINT(PROC_R): put _infile_;
"CHK-00"
514 cards4;

NOTE: The file "C:\Users\TEF419~1\AppData\Local\Temp\SAS Temporary
Files\_TD2256_WINDOWS7STATIC2_\r_code1802690920.r" is:

Filename=C:\Users\TEF419~1\AppData\Local\Temp\SAS Temporary
Files\_TD2256_WINDOWS7STATIC2_\r_code1802690920.r,
RECFM=V,LRECL=32767,File Size (bytes)=0,
Last Modified=14Feb2017:11:28:40,
Create Time=14Feb2017:11:28:40

NOTE: The DATA step has been abnormally terminated.

 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2189 views
  • 0 likes
  • 2 in conversation