BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
xiaoys0725
Fluorite | Level 6

Hello, 

 
I have an issue with runCode Action and save Action. 
 
1st one is the runCode Action. I submitted the following code, and cart is a cas table in a caslib called "MYCASLIB3". 
 
proc cas;
         datastep.runCode submit /                          
         code =  
         "data cart; 
         length id 8 name $100 units 8 price 8;
         id=1000; 
         name='iphone5s';
         units=1;
         price=4300;
         run;";                             
   run;
   quit;
 
I should have only 1 row in the output, while I got 8 rows. No idea why it is 8 rows. 
 
I also tried other codes like output statement, or "data cart;set work.cart;run;" every time I got 8 rows*the row I am supposed to have. 
 
2st thing is when I used the save action. My save action is like this("proc cas" omitted):
 
table.save /
    table="cart"
    caslib="MYCASLIB3"
    name="cart.sashdat"
    replace=true;
    run;
 
I found I cannot save the cart table into my cart.sashdat because I load the table from cart.sashdat and then fetched the table again and I still got the previous records. I also tried table={name="cart",caslib="MYCASLIB3"} and it still does not work. 
1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

Have a look at the dataStep.runCode action, if you are not reading from any table, the code gets execute on each node, this is why you get the 8 output rows.

 

You can specify the SINGLE="NOINPUT" to run the code only one node

 

datastep.runCode submit  status=rc /
  
   single="noinput" code=sasCode
   ;
 print rc;

See also DATA Step Processing Modes for more information.

View solution in original post

4 REPLIES 4
BrunoMueller
SAS Super FREQ

Have a look at the dataStep.runCode action, if you are not reading from any table, the code gets execute on each node, this is why you get the 8 output rows.

 

You can specify the SINGLE="NOINPUT" to run the code only one node

 

datastep.runCode submit  status=rc /
  
   single="noinput" code=sasCode
   ;
 print rc;

See also DATA Step Processing Modes for more information.

xiaoys0725
Fluorite | Level 6

Thank you, it works now. May I ask if you know about CAS REST API? I got another issue about the api when I ran fetch action

BrunoMueller
SAS Super FREQ

Please start a new thread with the question on the REST API.

 

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 3025 views
  • 2 likes
  • 2 in conversation