Help using Base SAS procedures

truncate and relaod a dataset in SAS

Reply
N/A
Posts: 0

truncate and relaod a dataset in SAS

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
Super Contributor
Posts: 359

Re: truncate and relaod a dataset in SAS

Posted in reply to deleted_user
A datastep with obs = 0

I would not suggest your approach though. drop the indexes and rebuild them would have much better performance.
N/A
Posts: 0

Re: truncate and relaod a dataset in SAS

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.
Super Contributor
Posts: 359

Re: truncate and relaod a dataset in SAS

Posted in reply to deleted_user
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.
Ask a Question
Discussion stats
  • 3 replies
  • 539 views
  • 0 likes
  • 2 in conversation