<?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 Re: Join to Transpose in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844930#M334034</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8409"&gt;@Babloo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;Currently I do not have any data or excepted results to share. Only thing which I want to know is how to transpose the proc sql with multiple left joins as shown in the post.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you know what you want to do. Otherwise you wouldn't be asking. Explain it. Make up some data. Make up the desired output. If you can't communicate what you want to do and show us, we can't help you.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Nov 2022 17:57:56 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-11-17T17:57:56Z</dc:date>
    <item>
      <title>Join to Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844633#M333922</link>
      <description>&lt;P&gt;Can someone help me to convert the below join code to proc transpose? Whether it is efficient if we do so?&lt;/P&gt;
&lt;P&gt;Currently I end up with I/O error due to many to many records after joins.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
Create table tst as
SELECT DISTINCT LEVEL_A,LEVEL_B,PT_NAME,BU, COM_CATG,CATG, PLN_TO, POSTNG_YR FROM WORK.FINAL_SUB t1
LEFT JOIN (   SELECT BU, CATG, PLN_TO,  NEW_GSV, NEW_TRADE
      FROM WORK.FINAL_SUB WHERE POSTNG_PED="1" ) per1
ON t1.BU=per1.BU AND t1.CATG=per1.CATG
AND t1.PLN_TO=per1.PLN_TO 
LEFT JOIN (   SELECT BU, CATG, PLN_TO,  NEW_GSV, NEW_TRADE
      FROM WORK.FINAL_SUB WHERE POSTNG_PED="2" ) per2
ON t1.BU=per2.BU AND t1.CATG=per2.CATG
AND t1.PLN_TO=per2.PLN_TO
LEFT JOIN (   SELECT BU, CATG, PLN_TO,  NEW_GSV, NEW_TRADE
      FROM WORK.FINAL_SUB WHERE POSTNG_PED="3" ) per3
ON t1.BU=per3.BU AND t1.CATG=per3.CATG
AND t1.PLN_TO=per3.PLN_TO
LEFT JOIN (   SELECT BU, CATG, PLN_TO,  NEW_GSV, NEW_TRADE
      FROM WORK.FINAL_SUB WHERE POSTNG_PED="4" ) per4
ON t1.BU=per4.BU AND t1.CATG=per4.CATG
AND t1.PLN_TO=per4.PLN_TO
LEFT JOIN (   SELECT BU, CATG, PLN_TO,  NEW_GSV, NEW_TRADE
      FROM WORK.FINAL_SUB WHERE POSTNG_PED="5" ) per5
ON t1.BU=per5.BU AND t1.CATG=per5.CATG
AND t1.PLN_TO=per5.PLN_TO
LEFT JOIN (   SELECT BU, CATG, PLN_TO,  NEW_GSV, NEW_TRADE
      FROM WORK.FINAL_SUB WHERE POSTNG_PED="6" ) per6
ON t1.BU=per6.BU AND t1.CATG=per6.CATG
AND t1.PLN_TO=per6.PLN_TO
LEFT JOIN (   SELECT BU, CATG, PLN_TO,  NEW_GSV, NEW_TRADE
      FROM WORK.FINAL_SUB WHERE POSTNG_PED="7" ) per7
ON t1.BU=per7.BU AND t1.CATG=per7.CATG
AND t1.PLN_TO=per7.PLN_TO
LEFT JOIN (   SELECT BU, CATG, PLN_TO,  NEW_GSV, NEW_TRADE
      FROM WORK.FINAL_SUB WHERE POSTNG_PED="8" ) per8
ON t1.BU=per8.BU AND t1.CATG=per8.CATG
AND t1.PLN_TO=per8.PLN_TO
LEFT JOIN (   SELECT BU, CATG, PLN_TO,  NEW_GSV, NEW_TRADE
      FROM WORK.FINAL_SUB WHERE POSTNG_PED="9" ) per9
ON t1.BU=per9.BU AND t1.CATG=per9.CATG
AND t1.PLN_TO=per9.PLN_TO
LEFT JOIN (   SELECT BU, CATG, PLN_TO,  NEW_GSV, NEW_TRADE
      FROM WORK.FINAL_SUB WHERE POSTNG_PED="10" ) per10
ON t1.BU=per10.BU AND t1.CATG=per10.CATG
AND t1.PLN_TO=per10.PLN_TO
LEFT JOIN (   SELECT BU, CATG, PLN_TO,  NEW_GSV, NEW_TRADE
      FROM WORK.FINAL_SUB WHERE POSTNG_PED="11" ) per11
ON t1.BU=per11.BU AND t1.CATG=per11.CATG
AND t1.PLN_TO=per11.PLN_TO
LEFT JOIN (   SELECT BU, CATG, PLN_TO,  NEW_GSV, NEW_TRADE
      FROM WORK.FINAL_SUB WHERE POSTNG_PED="12" ) per12
ON t1.BU=per12.BU AND t1.CATG=per12.CATG
AND t1.PLN_TO=per12.PLN_TO
LEFT JOIN (   SELECT BU, CATG, PLN_TO,  TEMP_GSV, TEMP_KMF
      FROM WORK.FINAL_SUB WHERE POSTNG_PED="&amp;amp;cperiod" ) submitted
ON t1.BU=submitted.BU AND t1.CATG=submitted.CATG
AND t1.PLN_TO=submitted.PLN_TO

;
quit;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Nov 2022 15:10:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844633#M333922</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2022-11-16T15:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Join to Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844636#M333923</link>
      <description>&lt;P&gt;I have to believe that TRANSPOSE will be more efficient than SQL. And it will likely take less time to program, as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As far as trying to replicate your SQL code in TRANSPOSE, can you provide a portion of the data set (as &lt;FONT color="#FF0000"&gt;working&lt;/FONT&gt; SAS data step code, and not as Excel or screen capture or any other method), and also provide the desired output? But better yet, before you do that, try TRANSPOSE yourself and see if you can get it to work.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 15:56:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844636#M333923</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-16T15:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Join to Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844650#M333925</link>
      <description>&lt;P&gt;The code does not make much sense.&amp;nbsp; If is left joining but not taking any variables from the additional tables it is joining with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you instead mean to use SQL like this instead?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SELECT t1.BU
     , t1.CATG
     , t1.PLN_TO
     , per1.new_gsv as GSV1 
     , per2.new_gsv as GSV2 
FROM WORK.FINAL_SUB t1
LEFT JOIN 
(SELECT BU, CATG, PLN_TO,  NEW_GSV, NEW_TRADE 
 FROM WORK.FINAL_SUB WHERE POSTNG_PED="1" ) per1
  ON t1.BU=per1.BU AND t1.CATG=per1.CATG
  AND t1.PLN_TO=per1.PLN_TO 
LEFT JOIN (   SELECT BU, CATG, PLN_TO,  NEW_GSV, NEW_TRADE
      FROM WORK.FINAL_SUB WHERE POSTNG_PED="2" ) per2
ON t1.BU=per2.BU AND t1.CATG=per2.CATG
AND t1.PLN_TO=per2.PLN_TO
....&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Nov 2022 16:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844650#M333925</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-16T16:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Join to Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844675#M333931</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;You are right. How to tackle now? I'd to like to how to write proc transpose from proc sql join?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 18:08:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844675#M333931</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2022-11-16T18:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Join to Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844719#M333953</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8409"&gt;@Babloo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;You are right. How to tackle now? I'd to like to how to write proc transpose from proc sql join?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Post example data, as already requested, and the expected result.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 22:14:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844719#M333953</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-11-16T22:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Join to Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844883#M334010</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;Currently I do not have any data or excepted results to share. Only thing which I want to know is how to transpose the proc sql with multiple left joins as shown in the post.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 14:43:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844883#M334010</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2022-11-17T14:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: Join to Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844884#M334011</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8409"&gt;@Babloo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;Currently I do not have any data or excepted results to share. Only thing which I want to know is how to transpose the proc sql with multiple left joins as shown in the post.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The SQL in the original post is gibberish.&amp;nbsp; It does nothing useful.&amp;nbsp; So it is hard to figure out how to convert it to anything&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It kind of looks like an attempt to do a transpose, but the list of variables selected (the list between SELECT and first LEFT JOIN keyword) does not reference any of the variables from the joined in datasets.&amp;nbsp; So it is impossible to tell what variable(s) you are trying to transpose.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 14:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844884#M334011</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-17T14:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Join to Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844930#M334034</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8409"&gt;@Babloo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;Currently I do not have any data or excepted results to share. Only thing which I want to know is how to transpose the proc sql with multiple left joins as shown in the post.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you know what you want to do. Otherwise you wouldn't be asking. Explain it. Make up some data. Make up the desired output. If you can't communicate what you want to do and show us, we can't help you.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 17:57:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844930#M334034</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-17T17:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Join to Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844939#M334040</link>
      <description>&lt;P&gt;You know what GIGO stands for? It means "garbage in, garbage out".&lt;/P&gt;
&lt;P&gt;Since your SQL code achieves nothing in the way of transposing, it's garbage, so we coukd only give you other garbage.&lt;/P&gt;
&lt;P&gt;Post usable example (fake) data, and the expected result. If you can't provide this, then we're talking about a non-issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 18:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-to-Transpose/m-p/844939#M334040</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-11-17T18:48:24Z</dc:date>
    </item>
  </channel>
</rss>

