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.
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.
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.
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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.