BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I'm a new sas user and find it very interesting but just don't have the luck in finding answers on the help file.

My problem is that I'm trying to use UPDATE statement to update my dataset, but it also includes the other observations w/c i don't need in my new data.

Please see sample below:

mydata1 (has 1,000 obs)
mydata2 (has 3,000 obs)

data mynewdata;
update mydata1 mydata2 UPDATEMODE=NOMISSINGCHECK|MISSINGCHECK;
by acctno;
run;


w/c results to 3,000 obs

How can I filter out (remove) the other data?

Hoping for your suggestions. Thanks
2 REPLIES 2
deleted_user
Not applicable
If you want to keep only which are in mydatset1, then you can say :

data mynewdata;
update mydata1 (in = in1)
mydata2 (in = in2);
by acctno;
if in1; /* This keeps all records in mydata1*/
run;

Hope this answers your question.
deleted_user
Not applicable
thanks shalini, i will try this

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 608 views
  • 0 likes
  • 1 in conversation