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;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 1044 views
  • 3 likes
  • 4 in conversation