BookmarkSubscribeRSS Feed
Rahul_B
Obsidian | Level 7

I have been Trying to perform updates on CAS tables.

 

I am able to perform simple updates in CAS, but not a complex ones.

 

proc cas;
cas_table.name ="CI_CUST_CONTACT_HISTORY_STAGE";
cas_table.where = "CONTACT_MONTH = 201907"; 

table.fetch /
table = cas_table;
run;

 

table.update /
table=cas_table
set={
{var="SEQUENCE_NO", value="SEQUENCE_NO*10"}
};
run;


table.fetch /
table = cas_table;
run;

 

How do i update  if i CONTACT_MONTH  more than 10000 contact_month  in where condition and variable to update SEQUENCE_NO is specific to the contact_month this is a complex update that am unable to do in CAS.

 

But what i tried to do use a loop that is time consuming.

 

%MACRO SCANLOOP;
/* First obtain the number of */
/* records in DATALOG */
DATA _NULL_;
IF 0 THEN SET hdfs_kim.CONTACT_UPD_JULY2019 NOBS=X;
CALL SYMPUT('RECCOUNT',X);
STOP;
RUN;

/* loop from one to number of */
/* records */
%DO I=1 %TO &RECCOUNT;
/* Advance to the Ith record */

proc cas;
cas_table.name ="CONTACT_UPD_JULY2019";
cas_table.where = "contact_key=442276500";
run;

table.update /
table=cas_table
set={
{var="SEQUENCE_NO", value="SEQUENCE_NO*100"}
};
run;


%END;
%MEND SCANLOOP;
/* Call SCANLOOP */
%SCANLOOP;
RUN;

 

Any help is much appreciated.

 

Thanks 

Rahul

7 REPLIES 7
alexal
SAS Employee

@Rahul_B ,

 

Here is a good example of how to use table.fetch & table.update.

Rahul_B
Obsidian | Level 7

i have used the same example used in my code, but i want update columns from one CAS table with another, that provision we dont have if in this example.

BrunoMueller
SAS Super FREQ

Have a look at the example I provided in this post, maybe it does what you need. I reads rows from one CAS table and update another CAS table

https://communities.sas.com/t5/Developers/Viya-CAS-tables-for-transactional-applications/m-p/555604/...

Rahul_B
Obsidian | Level 7

Thanks @BrunoMueller - your trick worked for smaller dataset but did not worked for the large dataset had perfromance issue  and the memory untilisation is increased while running the process.

Edoedoedo
Pyrite | Level 9

AFAIK, there is no way to massively update a CAS table "in place" (i.e. without dropping it and recreating it), as well as DELETE rows.

 

I understand CAS is for analytical, but I believe it lacks A LOT of database features.

I really hope that in the next releases the CAS will be more robust from this point of view, we had to rewrite tons of processes that worked correctly in LASR environment (which supports the UPDATE for instance) to implement workarounds for the things that cannot be made in CAS.

mretter
Calcite | Level 5
HEllo, @Edoedoedo, Have you found any way how to resolve the issue with updating of large data set on the metadata level without the lengthy reloading/recalculation all the data set?
Really important issue in use.
Thank you.
mretter
Calcite | Level 5
Update is = adding the new columns

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 7 replies
  • 4545 views
  • 1 like
  • 5 in conversation