## Base SAS

Solved
Occasional Contributor
Posts: 15

# Base SAS

[ Edited ]

I have two datasets

Dataset_1

PS    Lat   Long    Slot      Dist    XYZ

 abc 75.8233 26.2454 1 0 2 abc 75.4875 26.8997 2 0 2 xyz 75.4875 26.3842 1 0 2 xyz 75.7861 26.6884 2 0 2

and

Dataset_2

PS       Lat      Long     Slot       Dist      XYZ

 abc 75.4785 26.4589 1 0 -100 abc 75.5495 26.4679 1 7929.25 -100 abc 75.5649 26.7268 2 0 -100 abc 75.5666 26.8647 2 3843.27 -100 xyz 75.4937 26.5877 1 0 -100 xyz 75.8473 26.3971 1 39820.5 -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: 266

## Re: Base SAS

Posted in reply to 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;```

All Replies
Super User
Posts: 23,771

## 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: 13,583

## 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: 266

## Re: Base SAS

Posted in reply to 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
• 163 views
• 3 likes
• 4 in conversation