BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Himanshu007
Obsidian | Level 7

I have two datasets

 

Dataset_1

PS    Lat   Long    Slot      Dist    XYZ

abc75.823326.2454102
abc75.487526.8997202
xyz75.487526.3842102
xyz75.786126.6884202

 

 

 

and 

 

Dataset_2

PS       Lat      Long     Slot       Dist      XYZ

abc75.478526.458910.00-100
abc75.549526.467917929.25-100
abc75.564926.726820.00-100
abc75.566626.864723843.27-100
xyz75.493726.587710.00-100
xyz75.847326.3971139820.47-100

 

 

Now I want to append only those data from the second dataset to the first dataset which have dist less than 5000, 

so please suggest me a solution

Thnx in advance

@PeterClemmensen

1 ACCEPTED SOLUTION

Accepted Solutions
s_lassen
Meteorite | Level 14

@Himanshu007:

If I understand you correctly, the easiest and fastest is probably to use PROC APPEND:

proc append base=dataset_1 data=dataset_2(where=(dist<5000));
run;

View solution in original post

3 REPLIES 3
Reeza
Super User

You really shouldn't tag users in a question unless you only want that persons answer. They're also under no responsibility to answer your question. In fact, I usually don't when someone does that. 

 

You can use WHERE to filter the results in a SET statement. 

 

data want;
Set first second(where = (dist < 5000));

Run;
ballardw
Super User

And  did actually want the 0 distances or only the non-zero distances < 5000?

s_lassen
Meteorite | Level 14

@Himanshu007:

If I understand you correctly, the easiest and fastest is probably to use PROC APPEND:

proc append base=dataset_1 data=dataset_2(where=(dist<5000));
run;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1407 views
  • 3 likes
  • 4 in conversation