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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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