DATA Step, Macro, Functions and more

Matching value in two different tables

Reply
New Contributor
Posts: 4

Matching value in two different tables

[ Edited ]

I have two tables 1 and 2. Table 1 contains lenfol's values and it's matching Survival Distribution Function Estimate's values. In table 2, I want to add a column which store Survival Distribution Function Estimate's values which match lenfol's values in table 1. Can somebody point me in the way how I can set that up? Thanks!

 

Table 1

table1.PNG

 

Table 2

table2.PNG

Super Contributor
Posts: 252

Re: Matching value in two different tables

Posted in reply to ShinCrayons

If you can put your data into csv files and attach them, it should be pretty straight forward…

 

I could write up code which'd probably work, but it could quite possibly not work too!

PROC Star
Posts: 735

Re: Matching value in two different tables

Posted in reply to ShinCrayons

Posting sample data slong with your question makes it a lot easier to solve. 

 

But what you are looking for is probably something like this:

 

proc sql;
   create table yourtable as
   select a.*
         ,b.Survival_Distribution
   from table2 as a left join table1 as b
   on a.lenfol = b.lenfol;
quit;
Ask a Question
Discussion stats
  • 2 replies
  • 150 views
  • 0 likes
  • 3 in conversation