A view helps on deletes, but I wonder how it affects performance of =
querying the data- wouldn't storing the data in 24 different locations =
cause a significant slowdown in perfomance upon querying the data versus =
having it all in one table that is indexed? If this data is queryied a =
lot but only deleted once a month, the time in querying (which probably =
is in peak time) could be much more important than the time in deleting =
(which could be run when the computer is not busy, such as nights or =
weekends). =20
-Mary
----- Original Message -----=20
From: ./ ADD NAME=3DData _null_,=20
To: SAS-***@LISTSERV.UGA.EDU=20
Sent: Friday, August 15, 2008 3:51 PM
Subject: Re: Deleting SAS Data from a SAS DATASET
Summary: PROC DATASETS; AGE statement. + VIEWs
This won't help you delete data from your very big data set, but you
may find this example interesting.
You say you append data monthly to a big data set then when big gets
too big you need to clean out the old. And that takes a very long
time.
However if you don't physically append but use a view to
append/combine you may find it easier to get rid of the unwanted old
data.
Consider this code. it pushes MonthlyUpdate onto the stack of 24 data
sets and the 24th data set is deleted. Then all the data sets get
renamed to produce a new group of 24. You can see from the notes how
the operation works. The data sets don't have to use a numbered range
M01-M24 I did that for my convenience.
proc datasets library=3Dwork;
age MonthlyUpdate m01-m24;
run;
quit;
NOTE: Deleting WORK.M24 (memtype=3DDATA).
NOTE: Aging the name WORK.M23 to WORK.M24 (memtype=3DDATA).
NOTE: Aging the name WORK.M22 to WORK.M23 (memtype=3DDATA).
NOTE: Aging the name WORK.M21 to WORK.M22 (memtype=3DDATA).
NOTE: Aging the name WORK.M20 to WORK.M21 (memtype=3DDATA).
NOTE: Aging the name WORK.M19 to WORK.M20 (memtype=3DDATA).
NOTE: Aging the name WORK.M18 to WORK.M19 (memtype=3DDATA).
NOTE: Aging the name WORK.M17 to WORK.M18 (memtype=3DDATA).
NOTE: Aging the name WORK.M16 to WORK.M17 (memtype=3DDATA).
NOTE: Aging the name WORK.M15 to WORK.M16 (memtype=3DDATA).
NOTE: Aging the name WORK.M14 to WORK.M15 (memtype=3DDATA).
NOTE: Aging the name WORK.M13 to WORK.M14 (memtype=3DDATA).
NOTE: Aging the name WORK.M12 to WORK.M13 (memtype=3DDATA).
NOTE: Aging the name WORK.M11 to WORK.M12 (memtype=3DDATA).
NOTE: Aging the name WORK.M10 to WORK.M11 (memtype=3DDATA).
NOTE: Aging the name WORK.M09 to WORK.M10 (memtype=3DDATA).
NOTE: Aging the name WORK.M08 to WORK.M09 (memtype=3DDATA).
NOTE: Aging the name WORK.M07 to WORK.M08 (memtype=3DDATA).
NOTE: Aging the name WORK.M06 to WORK.M07 (memtype=3DDATA).
NOTE: Aging the name WORK.M05 to WORK.M06 (memtype=3DDATA).
NOTE: Aging the name WORK.M04 to WORK.M05 (memtype=3DDATA).
NOTE: Aging the name WORK.M03 to WORK.M04 (memtype=3DDATA).
NOTE: Aging the name WORK.M02 to WORK.M03 (memtype=3DDATA).
NOTE: Aging the name WORK.M01 to WORK.M02 (memtype=3DDATA).
NOTE: Aging the name WORK.MONTHLYUPDATE to WORK.M01 (memtype=3DDATA).
Here is a complete example. Somewhat contrived but I think is covers
most of the relevant points.
/* create example data base 2 years of monthly data */
filename makedata temp;
data _null_;
file makedata;
do m =3D 24 to 1 by -1;
month =3D intnx('MONTH',today(),-m,'B');
format month date9.;
put 'data m' m z2. ';';
put +3 'month=3D"' month +(-1)'"d;';
put +3 'do day =3D month to intnx("month",month,0,"E");';
put +6 'output;';
put +6 'end;';
put +3 'Format month monyy. day date.;';
put +3 'run;';
end;
run;
%inc makedata / source2;
/* macro var to make long list of member easier to manage */
%let members =3D ;
proc sql noprint;
select memname into :members separated by ' '
from dictionary.members
where libname eq 'WORK' and memname eqt 'M';
quit;
run;
%put NOTE: MEMBERS=3D&members;
/* a 2 year view */
data view24 / view=3Dview24;
set &members open=3Ddefer;
run;
/* New data for montly update */
data MonthlyUpdate;
month =3D intnx('MONTH',today(),0,'B');
do day =3D month to intnx("Month",month,0,"E");
output;
end;
format month monyy.;
run;
proc datasets library=3Dwork;
age MonthlyUpdate m01-m24;
run;
quit;
/* use the view to access the past 24 months of data */
proc print data=3Dview24;
run;
Post by SUBSCRIBE SAS-L Chandra GaddeHi All
I have several SAS datasets that are very very big. (50GB of size). =
Every
Post by SUBSCRIBE SAS-L Chandra Gaddemonth, the data is being appended to these datasets. I need to =
deleted the
Post by SUBSCRIBE SAS-L Chandra Gaddedata which is greater than 24 months. What is the best method to do =
this?
Post by SUBSCRIBE SAS-L Chandra GaddePlease help me.
I tried PROC SQS and DATA STEP. But these two are taking very long =
time.
Post by SUBSCRIBE SAS-L Chandra GaddeData prod.Master_data;
set prod.master_date;
if snap_dt =3D "&end_dt"d then delete;
run;
proc sql;
crete table prod.master_date from prod.master_date
where snap_dt ne "&end_dt"d;
quit;