"tin-shun-jimmy chan" <jimmy.chan@HEC.CA> wrote in message
> I want to know how to do something in one dataset according to some
> conditions in another dataset.
> For example, if nb > 200 for the i-th year in one dataset, then delete
> all the observations of the whole i-th year in another dataset.
> dataset 1
> year nb
> 1970 195
> 1980 205
> dataset 2
> year score
> 1970 20
> 1970 30
> 1970 35
> 1980 10
> 1980 15
> 1980 06
> So I want to delete all the 1980's observations in dataset 2 according
> to dataset 1.
> Thanks a lot.
You can use SQL to delete rows in place
You can use DATA;MODIFY; to delete rows in place
You can use DATA;SET; to create new dataset with rows deleted
Here is SQL
delete from TWO where year in (select year from ONE where nb > 200);
If you want to simply process the data through your 'nb>200' perspective
(while leaving original data intact), consider using a view
create view TWO_with_NB_LE_200 as
select * from TWO
where year in (select year from ONE where NB<=200)
Richard A. DeVenezia
Use Perl to create an Excel file containing one worksheet per SAS dataset