<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Merging two table in single report in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merging-two-table-in-single-report/m-p/55360#M5816</link>
    <description>Request To All SAS Experts,&lt;BR /&gt;
      I am currently doing the below excercise and as you can see not that expert.&lt;BR /&gt;
&lt;BR /&gt;
      Purpose:  &lt;BR /&gt;
      To get an monthly output and compare current with previous month plus the &lt;BR /&gt;
      output to be in Excel format.&lt;BR /&gt;
&lt;BR /&gt;
      &lt;B&gt;Question is HowTo:&lt;/B&gt;      &lt;BR /&gt;
       1) Display "Dispatch" value for "Sent-N" and "Sent-Y" alongwith "Total" on &lt;BR /&gt;
          same line with "Received"&lt;BR /&gt;
      2) Total to be displayed on Left.&lt;BR /&gt;
      3) Compare Current with previous month&lt;BR /&gt;
&lt;BR /&gt;
     &lt;B&gt;Output is: &lt;BR /&gt;
current month, prev. month and  difference between current to prev. month&lt;BR /&gt;
(Difficult to show in this thread  output format- can email excel file on request)&lt;BR /&gt;
    Column&lt;BR /&gt;
       1) Total of Modes-Post, Modes-Courier, Total of Dispatched&lt;BR /&gt;
       2) Received value will be  Modes-Post and Modes Courier&lt;BR /&gt;
             2a) Modes-Post value will be RcptDrtn (5d),RcptDrtn (15d)+(30d) and &lt;BR /&gt;
                       Total of All rcptDrtn&lt;BR /&gt;
              2b) Modes Courier (Only Display Total of (5d))&lt;BR /&gt;
       3) Dispatch value will be  Sent-N, Sent-Y and Total of Sent-N and Y&lt;BR /&gt;
      &lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
     Month-Jan 2010&lt;BR /&gt;
     Total	 /   Received                                        /Dispatched		&lt;BR /&gt;
                    Modes-Post                                            Modes-Courier&lt;BR /&gt;
MaterialName"RcptDrtn(5d)" / "RcptDrtn(15d,30d)"/ Total                    Sent-N	Sent-Y        Total&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Mtrl_A   4		                         1	              1	          2        &lt;BR /&gt;
1           1&lt;BR /&gt;
Mtrl_B   5		                         2	              2	          1	            1	      &lt;BR /&gt;
1           2&lt;BR /&gt;
......								&lt;BR /&gt;
Total	          &lt;BR /&gt;
&lt;U&gt;&lt;B&gt;      Problem:&lt;BR /&gt;
      Below are the two codes for Merging Two Tables and still not getting desired output.  &lt;BR /&gt;
&lt;BR /&gt;
Wanted to get values of RcptDrtn and SentYN value in one column if required R_Value and D_Value also in column to get expected output&lt;/B&gt;&lt;/U&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;Code 1&lt;/B&gt; &lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
 CREATE TABLE Work.MergeRecord AS &lt;BR /&gt;
 SELECT DISTINCT &lt;BR /&gt;
     MTRLRCVD.Category,&lt;BR /&gt;
     MTRLRCVD.Mtrl_Name,&lt;BR /&gt;
     MTRLRCVD.Modes,&lt;BR /&gt;
     MTRLRCVD.RcptDrtn,&lt;BR /&gt;
     MTRLDSPTCH.SentYN,&lt;BR /&gt;
     MTRLRCVD.R_Value as Received,&lt;BR /&gt;
     (CASE  WHEN MTRLDSPTCH.Modes  ="Post" THEN sum(MTRLDSPTCH.D_Value) &lt;BR /&gt;
                WHEN MTRLDSPTCH.Modes  ="Courier" THEN sum(MTRLDSPTCH.D_Value) &lt;BR /&gt;
       ELSE 0&lt;BR /&gt;
     END &lt;BR /&gt;
     ) AS Dispatch&lt;BR /&gt;
 FROM WORK.MTRLRCVD AS MTRLRCVD &lt;BR /&gt;
 FULL JOIN &lt;BR /&gt;
          WORK.MTRLDSPTCH AS MTRLDSPTCH &lt;BR /&gt;
             ON (MTRLRCVD.Modes = MTRLDSPTCH.Modes) &lt;BR /&gt;
           AND (MTRLRCVD.Category = MTRLDSPTCH.Category)&lt;BR /&gt;
           AND (MTRLRCVD.Mtrl_Name = MTRLDSPTCH.Mtrl_Name)&lt;BR /&gt;
 GROUP BY &lt;BR /&gt;
           MTRLRCVD.Category, &lt;BR /&gt;
           MTRLRCVD.Mtrl_Name, &lt;BR /&gt;
           MTRLRCVD.Modes&lt;BR /&gt;
 ORDER BY &lt;BR /&gt;
           MTRLRCVD.Category, &lt;BR /&gt;
           MTRLRCVD.Mtrl_Name, &lt;BR /&gt;
           MTRLRCVD.Modes;&lt;BR /&gt;
QUIT;&lt;BR /&gt;
&lt;BR /&gt;
      &lt;BR /&gt;
&lt;B&gt;Code 2&lt;/B&gt;&lt;BR /&gt;
 PROC SQL;&lt;BR /&gt;
   CREATE TABLE WORK.MergedTbl AS &lt;BR /&gt;
   SELECT DISTINCT t1.Mth, &lt;BR /&gt;
          t1.Category, &lt;BR /&gt;
          t1.Mtrl_Name, &lt;BR /&gt;
          t1.Modes, &lt;BR /&gt;
          t1.RcptDrtn as MergeFld, &lt;BR /&gt;
          t1.R_Value as OneValue&lt;BR /&gt;
   FROM WORK.MTRLRCVD AS t1&lt;BR /&gt;
union&lt;BR /&gt;
   SELECT DISTINCT t2.Mth, &lt;BR /&gt;
          t2.Category, &lt;BR /&gt;
          t2.Mtrl_Name, &lt;BR /&gt;
          t2.Modes, &lt;BR /&gt;
          t2.SentYN as MergeFld, &lt;BR /&gt;
          t2.D_Value as OneValue&lt;BR /&gt;
   FROM WORK.MTRLDSPTCH AS t2&lt;BR /&gt;
   Order by &lt;BR /&gt;
          t1.Category,&lt;BR /&gt;
		  t1.Mtrl_Name,&lt;BR /&gt;
		  t1.Modes&lt;BR /&gt;
   Where  t1.mth EQ t2.mth&lt;BR /&gt;
QUIT;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
///////////////////////////////////////////////////////     &lt;BR /&gt;
&lt;BR /&gt;
Below code is to create table and inserting data and is working&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create table MTRLRCVD&lt;BR /&gt;
    (Category    char(6) LABEL='Category',&lt;BR /&gt;
     Mth           char(6) LABEL='Month',&lt;BR /&gt;
     Mtrl_Name   Char(10) LABEL='Material',&lt;BR /&gt;
     Modes        Char(8) LABEL='Modes',&lt;BR /&gt;
     RcptDrtn     Char(3) LABEL='RcptDrtn',&lt;BR /&gt;
     R_Value      Decimal(4));&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create table MTRLDSPTCH&lt;BR /&gt;
    (Category    char(6) LABEL='Category',&lt;BR /&gt;
     Mth           char(6) LABEL='Month',&lt;BR /&gt;
     Mtrl_Name   Char(10) LABEL='Material',&lt;BR /&gt;
     Modes        Char(8) LABEL='Modes',&lt;BR /&gt;
     SentYN     Char(3) LABEL='SentYN',&lt;BR /&gt;
     D_Value      Decimal(2));&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_1','Jan-10','Mtrl_A','Post','15d',1);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_1','Jan-10','Mtrl_A','Courier','5d',2);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_2','Jan-10','Mtrl_B','Post','30d',2);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_2','Jan-10','Mtrl_B','Courier','5d',1);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_2','Jan-10','Mtrl_C','Post','5d',5);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_7','Jan-10','Mtrl_D','Post','30d',4);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_1','Feb-10','Mtrl_A','Post','15d',3);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_1','Feb-10','Mtrl_A','Courier','5d',1);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_2','Feb-10','Mtrl_B','Post','30d',2);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_2','Feb-10','Mtrl_B','Courier','5d',3);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_2','Feb-10','Mtrl_C','Post','5d',7);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_7','Feb-10','Mtrl_D','Post','30d',3);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_1','Jan-10','Mtrl_A','Post','Y',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_2','Jan-10','Mtrl_B','Post','N',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_2','Jan-10','Mtrl_B','Courier','Y',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_2','Jan-10','Mtrl_B','Courier','Y',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_4','Jan-10','Mtrl_C','Courier','N',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_7','Jan-10','Mtrl_D','Post','N',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_1','Feb-10','Mtrl_A','Post','Y',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_2','Feb-10','Mtrl_B','Post','N',0);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_2','Feb-10','Mtrl_B','Courier','Y',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_2','Feb-10','Mtrl_B','Courier','Y',0);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_4','Feb-10','Mtrl_C','Courier','N',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_7','Feb-10','Mtrl_D','Post','N',1);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
Tain</description>
    <pubDate>Sun, 25 Jul 2010 06:43:03 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-07-25T06:43:03Z</dc:date>
    <item>
      <title>Merging two table in single report</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merging-two-table-in-single-report/m-p/55360#M5816</link>
      <description>Request To All SAS Experts,&lt;BR /&gt;
      I am currently doing the below excercise and as you can see not that expert.&lt;BR /&gt;
&lt;BR /&gt;
      Purpose:  &lt;BR /&gt;
      To get an monthly output and compare current with previous month plus the &lt;BR /&gt;
      output to be in Excel format.&lt;BR /&gt;
&lt;BR /&gt;
      &lt;B&gt;Question is HowTo:&lt;/B&gt;      &lt;BR /&gt;
       1) Display "Dispatch" value for "Sent-N" and "Sent-Y" alongwith "Total" on &lt;BR /&gt;
          same line with "Received"&lt;BR /&gt;
      2) Total to be displayed on Left.&lt;BR /&gt;
      3) Compare Current with previous month&lt;BR /&gt;
&lt;BR /&gt;
     &lt;B&gt;Output is: &lt;BR /&gt;
current month, prev. month and  difference between current to prev. month&lt;BR /&gt;
(Difficult to show in this thread  output format- can email excel file on request)&lt;BR /&gt;
    Column&lt;BR /&gt;
       1) Total of Modes-Post, Modes-Courier, Total of Dispatched&lt;BR /&gt;
       2) Received value will be  Modes-Post and Modes Courier&lt;BR /&gt;
             2a) Modes-Post value will be RcptDrtn (5d),RcptDrtn (15d)+(30d) and &lt;BR /&gt;
                       Total of All rcptDrtn&lt;BR /&gt;
              2b) Modes Courier (Only Display Total of (5d))&lt;BR /&gt;
       3) Dispatch value will be  Sent-N, Sent-Y and Total of Sent-N and Y&lt;BR /&gt;
      &lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
     Month-Jan 2010&lt;BR /&gt;
     Total	 /   Received                                        /Dispatched		&lt;BR /&gt;
                    Modes-Post                                            Modes-Courier&lt;BR /&gt;
MaterialName"RcptDrtn(5d)" / "RcptDrtn(15d,30d)"/ Total                    Sent-N	Sent-Y        Total&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Mtrl_A   4		                         1	              1	          2        &lt;BR /&gt;
1           1&lt;BR /&gt;
Mtrl_B   5		                         2	              2	          1	            1	      &lt;BR /&gt;
1           2&lt;BR /&gt;
......								&lt;BR /&gt;
Total	          &lt;BR /&gt;
&lt;U&gt;&lt;B&gt;      Problem:&lt;BR /&gt;
      Below are the two codes for Merging Two Tables and still not getting desired output.  &lt;BR /&gt;
&lt;BR /&gt;
Wanted to get values of RcptDrtn and SentYN value in one column if required R_Value and D_Value also in column to get expected output&lt;/B&gt;&lt;/U&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;Code 1&lt;/B&gt; &lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
 CREATE TABLE Work.MergeRecord AS &lt;BR /&gt;
 SELECT DISTINCT &lt;BR /&gt;
     MTRLRCVD.Category,&lt;BR /&gt;
     MTRLRCVD.Mtrl_Name,&lt;BR /&gt;
     MTRLRCVD.Modes,&lt;BR /&gt;
     MTRLRCVD.RcptDrtn,&lt;BR /&gt;
     MTRLDSPTCH.SentYN,&lt;BR /&gt;
     MTRLRCVD.R_Value as Received,&lt;BR /&gt;
     (CASE  WHEN MTRLDSPTCH.Modes  ="Post" THEN sum(MTRLDSPTCH.D_Value) &lt;BR /&gt;
                WHEN MTRLDSPTCH.Modes  ="Courier" THEN sum(MTRLDSPTCH.D_Value) &lt;BR /&gt;
       ELSE 0&lt;BR /&gt;
     END &lt;BR /&gt;
     ) AS Dispatch&lt;BR /&gt;
 FROM WORK.MTRLRCVD AS MTRLRCVD &lt;BR /&gt;
 FULL JOIN &lt;BR /&gt;
          WORK.MTRLDSPTCH AS MTRLDSPTCH &lt;BR /&gt;
             ON (MTRLRCVD.Modes = MTRLDSPTCH.Modes) &lt;BR /&gt;
           AND (MTRLRCVD.Category = MTRLDSPTCH.Category)&lt;BR /&gt;
           AND (MTRLRCVD.Mtrl_Name = MTRLDSPTCH.Mtrl_Name)&lt;BR /&gt;
 GROUP BY &lt;BR /&gt;
           MTRLRCVD.Category, &lt;BR /&gt;
           MTRLRCVD.Mtrl_Name, &lt;BR /&gt;
           MTRLRCVD.Modes&lt;BR /&gt;
 ORDER BY &lt;BR /&gt;
           MTRLRCVD.Category, &lt;BR /&gt;
           MTRLRCVD.Mtrl_Name, &lt;BR /&gt;
           MTRLRCVD.Modes;&lt;BR /&gt;
QUIT;&lt;BR /&gt;
&lt;BR /&gt;
      &lt;BR /&gt;
&lt;B&gt;Code 2&lt;/B&gt;&lt;BR /&gt;
 PROC SQL;&lt;BR /&gt;
   CREATE TABLE WORK.MergedTbl AS &lt;BR /&gt;
   SELECT DISTINCT t1.Mth, &lt;BR /&gt;
          t1.Category, &lt;BR /&gt;
          t1.Mtrl_Name, &lt;BR /&gt;
          t1.Modes, &lt;BR /&gt;
          t1.RcptDrtn as MergeFld, &lt;BR /&gt;
          t1.R_Value as OneValue&lt;BR /&gt;
   FROM WORK.MTRLRCVD AS t1&lt;BR /&gt;
union&lt;BR /&gt;
   SELECT DISTINCT t2.Mth, &lt;BR /&gt;
          t2.Category, &lt;BR /&gt;
          t2.Mtrl_Name, &lt;BR /&gt;
          t2.Modes, &lt;BR /&gt;
          t2.SentYN as MergeFld, &lt;BR /&gt;
          t2.D_Value as OneValue&lt;BR /&gt;
   FROM WORK.MTRLDSPTCH AS t2&lt;BR /&gt;
   Order by &lt;BR /&gt;
          t1.Category,&lt;BR /&gt;
		  t1.Mtrl_Name,&lt;BR /&gt;
		  t1.Modes&lt;BR /&gt;
   Where  t1.mth EQ t2.mth&lt;BR /&gt;
QUIT;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
///////////////////////////////////////////////////////     &lt;BR /&gt;
&lt;BR /&gt;
Below code is to create table and inserting data and is working&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create table MTRLRCVD&lt;BR /&gt;
    (Category    char(6) LABEL='Category',&lt;BR /&gt;
     Mth           char(6) LABEL='Month',&lt;BR /&gt;
     Mtrl_Name   Char(10) LABEL='Material',&lt;BR /&gt;
     Modes        Char(8) LABEL='Modes',&lt;BR /&gt;
     RcptDrtn     Char(3) LABEL='RcptDrtn',&lt;BR /&gt;
     R_Value      Decimal(4));&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create table MTRLDSPTCH&lt;BR /&gt;
    (Category    char(6) LABEL='Category',&lt;BR /&gt;
     Mth           char(6) LABEL='Month',&lt;BR /&gt;
     Mtrl_Name   Char(10) LABEL='Material',&lt;BR /&gt;
     Modes        Char(8) LABEL='Modes',&lt;BR /&gt;
     SentYN     Char(3) LABEL='SentYN',&lt;BR /&gt;
     D_Value      Decimal(2));&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_1','Jan-10','Mtrl_A','Post','15d',1);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_1','Jan-10','Mtrl_A','Courier','5d',2);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_2','Jan-10','Mtrl_B','Post','30d',2);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_2','Jan-10','Mtrl_B','Courier','5d',1);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_2','Jan-10','Mtrl_C','Post','5d',5);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_7','Jan-10','Mtrl_D','Post','30d',4);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_1','Feb-10','Mtrl_A','Post','15d',3);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_1','Feb-10','Mtrl_A','Courier','5d',1);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_2','Feb-10','Mtrl_B','Post','30d',2);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_2','Feb-10','Mtrl_B','Courier','5d',3);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_2','Feb-10','Mtrl_C','Post','5d',7);&lt;BR /&gt;
insert into MTRLRCVD  values('Ctgy_7','Feb-10','Mtrl_D','Post','30d',3);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_1','Jan-10','Mtrl_A','Post','Y',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_2','Jan-10','Mtrl_B','Post','N',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_2','Jan-10','Mtrl_B','Courier','Y',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_2','Jan-10','Mtrl_B','Courier','Y',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_4','Jan-10','Mtrl_C','Courier','N',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_7','Jan-10','Mtrl_D','Post','N',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_1','Feb-10','Mtrl_A','Post','Y',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_2','Feb-10','Mtrl_B','Post','N',0);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_2','Feb-10','Mtrl_B','Courier','Y',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_2','Feb-10','Mtrl_B','Courier','Y',0);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_4','Feb-10','Mtrl_C','Courier','N',1);&lt;BR /&gt;
insert into MTRLDSPTCH  values('Ctgy_7','Feb-10','Mtrl_D','Post','N',1);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
Tain</description>
      <pubDate>Sun, 25 Jul 2010 06:43:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merging-two-table-in-single-report/m-p/55360#M5816</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-07-25T06:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: Merging two table in single report</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merging-two-table-in-single-report/m-p/55361#M5817</link>
      <description>Hi Tain&lt;BR /&gt;
&lt;BR /&gt;
The following SQL creates the Work.MergeRecord in the form you might want it. Hope this brings you a step further in solving your exercise.&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  CREATE TABLE Work.MergeRecord AS&lt;BR /&gt;
  select&lt;BR /&gt;
    coalesce(l.Category,r.Category)   as Category LABEL='Category' length=6 format=$6.,&lt;BR /&gt;
    coalesce(l.Mth,r.Mth)             as Mth LABEL='Month' length=6 format=$6.,&lt;BR /&gt;
    coalesce(l.Mtrl_Name,r.Mtrl_Name) as Mtrl_Name LABEL='Material' length=10 format=$10.,&lt;BR /&gt;
    coalesce(l.Modes,r.Modes)         as Modes LABEL='Modes' length=8 format=$8.,&lt;BR /&gt;
    l.RcptDrtn,&lt;BR /&gt;
    l.R_Value,&lt;BR /&gt;
    r.SentYN,&lt;BR /&gt;
    r.D_Value&lt;BR /&gt;
      from MTRLRCVD as l,MTRLDSPTCH as r&lt;BR /&gt;
        where l.Category=r.Category and l.Mth=r.Mth and l.Mtrl_Name=r.Mtrl_Name and l.Modes=r.Modes&lt;BR /&gt;
  ;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick

P.S: Doing this in a data step merge would have been less coding but I assumed you need it solved in SQL.&lt;BR /&gt;
&lt;BR /&gt;
    &lt;BR /&gt;
Message was edited by: Patrick</description>
      <pubDate>Tue, 27 Jul 2010 09:01:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merging-two-table-in-single-report/m-p/55361#M5817</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-07-27T09:01:05Z</dc:date>
    </item>
  </channel>
</rss>

