DATA Step, Macro, Functions and more

Base SAS

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

Base SAS

[ Edited ]

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

@draycut


Accepted Solutions
Solution
‎06-07-2017 01:02 AM
PROC Star
Posts: 102

Re: Base SAS

Posted in reply to Himanshu007

@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


All Replies
Super User
Posts: 19,861

Re: Base SAS

Posted in reply to Himanshu007

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;
Super User
Posts: 11,343

Re: Base SAS

Posted in reply to Himanshu007

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

Solution
‎06-07-2017 01:02 AM
PROC Star
Posts: 102

Re: Base SAS

Posted in reply to Himanshu007

@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;
☑ This topic is solved.

Need further help from the community? Please ask a new question.

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