BookmarkSubscribeRSS Feed
mariopellegrini
Pyrite | Level 9

Goodmorning everyone.


Maybe I didn't understand the mechanism of multi threads.


With this simple test code:

cas mySession sessopts = (caslib = casuser timeout = 1800 locale = "en_US");
libname mycas cas caslib = casuser;

data mycas.ds1; 
x=2; 
put "The # of Threads is " _nthreads_; /* 3 */ 
run;

I get 12 lines instead of 1 and the following message in the log:

NOTES: Running DATA step in Cloud Analytic Services.
Processed intro on _THREADID_ = 11 _NTHREADS_ = 12
Processed intro on _THREADID_ = 4 _NTHREADS_ = 12
Processed intro on _THREADID_ = 2 _NTHREADS_ = 12
Processed intro on _THREADID_ = 5 _NTHREADS_ = 12
Processed intro on _THREADID_ = 3 _NTHREADS_ = 12
Processed intro on _THREADID_ = 1 _NTHREADS_ = 12
Processed intro on _THREADID_ = 12 _NTHREADS_ = 12
Processed intro on _THREADID_ = 7 _NTHREADS_ = 12
Processed intro on _THREADID_ = 10 _NTHREADS_ = 12
Processed intro on _THREADID_ = 8 _NTHREADS_ = 12
Processed intro on _THREADID_ = 9 _NTHREADS_ = 12
Processed intro on _THREADID_ = 6 _NTHREADS_ = 12
NOTE: The ds1 table in caslib CASUSER (sasdemo) has 12 observations and 1 variables.
NOTES: DATA statement used (total processing time):
real time 0.02 seconds
cpu time 0.01 seconds

 

Why? What is the correct way to load a table into a caslib?
Thank you

5 REPLIES 5
BrunoMueller
SAS Super FREQ

The example shows that the DATA Step processing is divided into multiple threads. However your code and the provided log do not fit together.

 

You are not actually loading any data.

 

Please provide some more information like:

  • SAS Viya version
  • What kind of data do you want to load
  • Where is this data, on the SAS Viya server or somewhere else
mario_pelleg
Fluorite | Level 6
Bruno_SAS, with that code I loaded 12 lines.
Mine is a trivial example to show how to insert a simple 1 row table, in reality it inserts 12. I would like to understand how to make a correct loading.
the trivial datastep is:
mycas.ds1;
x = 2;
run;
BrunoMueller
SAS Super FREQ

Well have a look here https://go.documentation.sas.com/?docsetId=casdspgm&docsetTarget=n183xun5dd4dy5n1x453fw5reu8o.htm&do... it explains there various process modes.

 

In your case you need the SINGLE=YES option on the DATA statement like so:

data mycas.sometable / single=yes;
...
run;
mario_pelleg
Fluorite | Level 6

thanks for the link to the documentation.
However, I still struggle to understand the meaning.
In practice, for large tables, it is better to do processing using the multi thread. But if I get an incorrect result (the example of 12 lines instead of 1) what do I do with speed?

BrunoMueller
SAS Super FREQ

As asked already earlier, we do need some details on the type of data that you want to load to CAS:

  • SAS Viya version
  • What kind of data do you want to load
  • Where is this data, on the SAS Viya server or somewhere else

Also you should have a look here: https://go.documentation.sas.com/?docsetId=casfun&docsetTarget=n09ssmi0ko8uyfn1022ezo2hv0pm.htm&docs...

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!

Discussion stats
  • 5 replies
  • 916 views
  • 2 likes
  • 3 in conversation