BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I have a data set in SAS for which I have created index on some columns.
I would like to truncate this data and would still like to retain the index on the tables. In other words , I want to delete the data from this data set , but the table structure and the indexes will remain the same.

can somebody pls help me with this.?

Thanks
3 REPLIES 3
Flip
Fluorite | Level 6
A datastep with obs = 0

I would not suggest your approach though. drop the indexes and rebuild them would have much better performance.
deleted_user
Not applicable
Hello Thanks for you reply.

I tried that option also. But the indexes are deleted.
options obs=0;
data
set
run;
The reason why I'm taking this approach it I have a very large SAS data set that has 3 million rows and I need to truncate this data set and reload it quite often,
It is taking lot of time to create index on this large dataset.
Flip
Fluorite | Level 6
Based on an old V8 data warehouse I took over several years ago (so results may differ in V9) the weekly data refresh was taking 15 hours with indexes in place. It dropped to 15 min by dropping the index. loading data and rebuilding the index. The index will be rebuilt either way. The difference is that you (at least in V8) were rebuilding the index after each observation rather than all at once.


data (index = ());
set (obs = 0);
run;

will truncate the data and rebuild the empty index.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3046 views
  • 0 likes
  • 2 in conversation