Help using Base SAS procedures

Many-tomany

Reply
Super Contributor
Posts: 1,040

Many-tomany

I am merging these two tables.and i am getting table3

in most cases table 1 has many observations than table2 for the same ID

is it OK to merge even if the table 1 has less records for the same ID than table2?????

the result in table 3 is in a format i wanted......can i ignore the NOTE????


table1                                         table2

ID     charges                           ID    Trials

101                                         101     22

101                                         101    25

101                                         101    23

101                                         102   10

101                                         102   11

101

101

101

101

101

101

102

102

102

102

table3

ID     charges   Trials

101                     22                  

101                     25                                  

101                     23                                 

101                    23       -----23 spans till the next ID.BUT THAT IS ALSO FINE WITH ME

101                    23

101                    23

101                   23

101                   23

101                  23

101                 23

101                 23

102                 10

102                 11  ---spans

102                  11

102                 11

I get a message that merge has more than one dataset with repeats of BY variables

Super User
Posts: 5,255

Re: Many-tomany

The NOTE is there because in most scenarios, you don't want that result, it is unpredictable.

And the same here, why is it ok to repeat the value of the last trail for each ID? What is it you really want...?

Data never sleeps
Ask a Question
Discussion stats
  • 1 reply
  • 186 views
  • 0 likes
  • 2 in conversation