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-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 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
  • 711 views
  • 0 likes
  • 2 in conversation