| 1. |
How Do You Merge Data In Proc Sql? |
|
Answer» The three TYPES of join are inner join, left join and right join. The inner join option TAKES the matching values from both the tables by the ON option. The left join selects all the VARIABLES from the first table and JOINS second table to it. The right join selects all the variables of table b first and join the table a to it. PROC SQL; CREATE TABLE BOTH AS SELECT A.PATIENT, A.DATE FORMAT=DATE7. AS DATE, A.PULSE,B.MED, B.DOSES, B.AMT FORMAT=4.1 FROM VITALS A INNER JOIN DOSING B ON (A.PATIENT = B.PATIENT) AND(A.DATE = B.DATE) ORDER BY PATIENT, DATE; QUIT; The three types of join are inner join, left join and right join. The inner join option takes the matching values from both the tables by the ON option. The left join selects all the variables from the first table and joins second table to it. The right join selects all the variables of table b first and join the table a to it. PROC SQL; CREATE TABLE BOTH AS SELECT A.PATIENT, A.DATE FORMAT=DATE7. AS DATE, A.PULSE,B.MED, B.DOSES, B.AMT FORMAT=4.1 FROM VITALS A INNER JOIN DOSING B ON (A.PATIENT = B.PATIENT) AND(A.DATE = B.DATE) ORDER BY PATIENT, DATE; QUIT; |
|