BookmarkSubscribeRSS Feed
Sophie_12
Calcite | Level 5

If I have a dataset with several variables and then want to
link up that dataset to another set , for eg...

   

Dataset 1:

ID     Pass/Fail     Type

1              pass       Type1

2              Fail         Type2

3              fail          Type1

4              pass       Type2

5              fail          Type1

DATSET 2:

ID       GROUP

1              A

2              B

3              C

4              D

5              E

How can I use ID from dataset 2 and check if they are type 1
in dataset 1 and check whether it failed or passed ?

 

And how can I make it more dynamic, as I will have to do
this every month with a new data but same variables.

Thanks

1 REPLY 1
TarunKumar
Pyrite | Level 9

DATA TEST_1;

INPUT ID     Pass_Fail:$4.     Type:$5.;

DATALINES;

1              pass       Type1

2              Fail         Type2

3              fail          Type1

4              pass       Type2

5              fail          Type1

;RUN;

DATA TEST_2;

INPUT ID       GROUP:$1.;

DATALINES;

1              A

2              B

3              C

4              D

5              E

;RUN;

PROC SQL;

CREATE TABLE WANT AS

select a.*,b.GROUP

from test_1 a

left join test_2 b on a.id = b.id

where a.type = 'Type1';

QUIT;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1213 views
  • 0 likes
  • 2 in conversation