BookmarkSubscribeRSS Feed
smm662002
Quartz | Level 8

Hello,

 

The tests have been done on VIYA LTS 2023.03 and VIYA LTS 2024.09

 

I have tried to add a new index to a promoted table which has already other indexes (the reason why a new index has  to be added at a later moment rather than from the beginning is because new requirements and also the table is quite large and I try to avoid delete it and recreate it)

 

For the tests  I have used the table sashelp.cars which has been added to casuser and promoted. The first index has been added to variable "make" and a new table has been created and promoted. table.columnInfo has been used to check if the index has been applied  (please see code below).

 

proc cas;
table.index /
table={caslib='casuser',name="cars"},
casOut={name="cars_idx2", caslib='casuser',indexVars={"make"},promote=True};


table.columnInfo /table={name="cars_idx2",caslib="casuser"};

quit;

 

Later I have tried to add a new index to variable "type" to the promoted table casuser.cars_idx2. (the code is below)

 

proc cas;                                                          
table.index /
table={caslib='casuser',name="cars_idx2"},
casOut={name="cars_idx2", caslib='casuser',
indexVars={"type"} ,replace=True};
table.columnInfo / table={name="cars_idx2", caslib="casuser"};
table.tableInfo / caslib="casuser", name="cars_idx2";
quit;

smm662002_0-1744104128830.png

 

 

From table.columnInfo we can see that the index has been applied, but, looking at table.tableInfo results we can see that the scope of table cars_idx2 is no longer global but session scope. 
The output of table.columnInfo and table.tableInfo is abovew. A similar behavior was presented in the article http://proc-x.com/2020/12/append-and-replace-records-in-a-cas-table/ where manipulating promoted cas table with data steps can leads to duplication of data.

But in this scenario it seems that even a cas action can lead to duplicated data having local and global scope. I hoped that using "replace=True" would help.

 

Can I apply a new index to an existing promoted indexed table without having to delete and recreate that table?

 

Thank you for your comments.

 

Regards,

smm662002

1 REPLY 1

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Discussion stats
  • 1 reply
  • 918 views
  • 0 likes
  • 2 in conversation