Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

common link between 2 different datasets

Reply
New Contributor
Posts: 3

common link between 2 different datasets

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

Frequent Contributor
Posts: 78

Re: common link between 2 different datasets

Posted in reply to Sophie_12

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;

Ask a Question
Discussion stats
  • 1 reply
  • 205 views
  • 0 likes
  • 2 in conversation