BookmarkSubscribeRSS Feed
WorkingMan
Calcite | Level 5

Hi, I want to list out all BASE tables and indexes in a SAS library and then recreate using data set statement.

 

Normal data set without modify statement will wipe out the index option of the original table.

 

Assuming I have 30 tables in the library, how can i list out all table name and its index columns? I don't see that in dictionary table. If it is found in anywhere, i can assign it to a macro to perform the magic loop for all tables.

 

 

3 REPLIES 3
Reeza
Super User

SASHELP.VINDEX, which is probably dictionary.index, will show which indexes are applicable to your data sets. Or the PROC DATASETS output.

 

What's a "magic loop"?

 


@WorkingMan wrote:

Hi, I want to list out all BASE tables and indexes in a SAS library and then recreate using data set statement.

 

Normal data set without modify statement will wipe out the index option of the original table.

 

Assuming I have 30 tables in the library, how can i list out all table name and its index columns? I don't see that in dictionary table. If it is found in anywhere, i can assign it to a macro to perform the magic loop for all tables.

 

 


 

ChrisNZ
Tourmaline | Level 20

Why recreate the tables as is? Do you intend to change anything?

Also don't forget to set the sorted by  flag, if applicable, in your permanent tables.

Ksharp
Super User

Try this code,it could list info of WORK .Check "Use of Variable in Indexes".

data class(index=(x=(name sex)));set sashelp.class;run;
data class1;set sashelp.class;run;

proc contents data=work._all_ out=want noprint  ;
run;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 1119 views
  • 2 likes
  • 4 in conversation