Bits
Bits

Reputation: 276

Base SAS programming

My dataset consists a variable named as "REPORTING_ENTITY" in the form of string. Now, from that variable i want create a new dataset which consist a observations with keywords as ('Bank','Loan','Cooperative','SBI','Insurance') from "REPORTING_ENTITY" also want that strings get deleted from original dataset. I did something like:

data class.sample;
set work.sample;
where REPORTING_ENTITY contains ('Bank','Loan','Cooperative','SBI','Insurance');
run;

This will create a new dataset with mentioned keywords but it will not get deleted from orignal dataset..

Upvotes: 0

Views: 214

Answers (1)

user667489
user667489

Reputation: 9569

One way to do this is to overwrite the input dataset while simultaneously creating a new output dataset:

data class.sample
     work.sample;
set work.sample;
if REPORTING_ENTITY in ('Bank','Loan','Cooperative','SBI','Insurance') 
  then output class.sample;
  else output work.sample;
run;

Upvotes: 2

Related Questions