<?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: PROC SQL LEFT JOIN HAPPEND BUT Most VALUE IS SHOWN in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/937989#M368491</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/419260"&gt;@raheleh22&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am having trouble to know why my syntax not working properly. I am using a left join to join two tables based on 2 mutual coloumn ( Fipscode &amp;amp; Datetime) I made sure these two columns formatting are same before merging and here is my syntax:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE pamspi AS SELECT FROM PAMV1 LEFT JOIN spi12 ON pamV1.FIPScode=spi12.FIPScode AND pamv1.Datetime=spi12.Datetime;&lt;BR /&gt;QUIT;&lt;BR /&gt;proc print data=pamspi;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE pamspi AS SELECT * FROM PAMV1 LEFT JOIN spi12 ON pamV1.FIPScode=spi12.FIPScode AND pamv1.Datetime=spi12.Datetime;
QUIT;
proc print data=pamspi;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and here is what happens:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-08-01 122943.jpg" style="width: 693px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98960i528DF94DEED04F0F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-08-01 122943.jpg" alt="Screenshot 2024-08-01 122943.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see out of 143 obs I was expecting to be merged only 4 rows values have been merged and all others are showing missing as above. any thoughts on this?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Very simple. You have only 4 matches.&lt;/P&gt;
&lt;P&gt;Maxim 3: Know Your Data. This includes all data types, formats, and&amp;nbsp;&lt;EM&gt;real&lt;/EM&gt; values.&lt;/P&gt;
&lt;P&gt;Are values left- or right-aligned (leading blanks!)?&lt;/P&gt;
&lt;P&gt;Do such codes have leading zeroes in one dataset, but not the other (could be the result if codes were stored as numbers along the way)?&lt;/P&gt;</description>
    <pubDate>Thu, 01 Aug 2024 16:49:20 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2024-08-01T16:49:20Z</dc:date>
    <item>
      <title>PROC SQL LEFT JOIN HAPPEND BUT NO VALUE IS SHOWN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/930541#M366116</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using proc sql left join to merge my two excels on based on two mutual columns they have.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is the code I use:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;CREATE TABLE FINALV3 AS SELECT * FROM WNPOP LEFT JOIN pop2012 ON WNPOP.State_Name_All=pop2012.State_Name_All AND WNPOP.County_Name_All=pop2012.County_Name_All;&lt;BR /&gt;QUIT;&lt;/P&gt;
&lt;P&gt;while the proc happened and I can see the columns joined and the number of obs are correct, I do not have values in the joined columns. (THERE IS NO ERROR in the LOG ).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;any ideas of what is going wrong?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-06-01 142840.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96913i2ACCE279BB864601/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-06-01 142840.jpg" alt="Screenshot 2024-06-01 142840.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jun 2024 18:30:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/930541#M366116</guid>
      <dc:creator>raheleh22</dc:creator>
      <dc:date>2024-06-01T18:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL LEFT JOIN HAPPEND BUT NO VALUE IS SHOWN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/930544#M366118</link>
      <description>&lt;P&gt;Looks like no match was found.&lt;/P&gt;
&lt;P&gt;Inspect your data for the values of your key variables. Exact spelling, upper/lowercase, leading blanks.&lt;/P&gt;
&lt;P&gt;Also stop using the asterisk, it will cause at least WARNINGs for the key variables, and it might also be the cause of your problem if variables are present in both datasets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jun 2024 19:52:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/930544#M366118</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-06-01T19:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL LEFT JOIN HAPPEND BUT NO VALUE IS SHOWN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/930545#M366119</link>
      <description>&lt;P&gt;the mutual columns in these two tables are county_name_all and state_name_all and that is why i am doing the join based on these two. I have double checked and they are same in every thing in both excels. i even check and their excel format are same too. but still I have the problem&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jun 2024 20:13:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/930545#M366119</guid>
      <dc:creator>raheleh22</dc:creator>
      <dc:date>2024-06-01T20:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL LEFT JOIN HAPPEND BUT NO VALUE IS SHOWN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/930546#M366120</link>
      <description>&lt;P&gt;You constantly talk about "Excels", but this here are the SAS communities, where datasets are used.&lt;/P&gt;
&lt;P&gt;Don't trust anything you see in Excel. Inspect the datasets after import in SAS, using SAS means, e.g. displaying character values with $HEX formats to reveal hidden characters and the like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If a join "does not work", then the key values do not match, period.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jun 2024 20:22:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/930546#M366120</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-06-01T20:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL LEFT JOIN HAPPEND BUT NO VALUE IS SHOWN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/930556#M366123</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/419260"&gt;@raheleh22&lt;/a&gt;&amp;nbsp;The screenshot indicates that none of the rows from the "left" table joins with the "main" table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Often such "issues" occur when there are leading blanks or especially differences in casing. Try if below code returns the desired result.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql feedback;
  create table finalv3 as 
    select *
    from wnpop l
    left join pop2012 r 
      on    upcase(strip(wnpop.state_name_all)) =upcase(strip(pop2012.state_name_all))
        and upcase(strip(wnpop.county_name_all))=upcase(strip(pop2012.county_name_all))
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jun 2024 03:08:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/930556#M366123</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-06-02T03:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL LEFT JOIN HAPPEND BUT NO VALUE IS SHOWN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/930559#M366124</link>
      <description>&lt;P&gt;Without actual values from the data set we cannot tell what actually happens.&lt;/P&gt;
&lt;P&gt;The two most common causes for text values not matching are case, such as ALL UPPER CASE letters not matching Some Upper Case letters. The other is presence of leading spaces in one or more of the variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;proc sql;
CREATE TABLE FINALV3 AS 
SELECT Wnpop.* , pop2012.*
FROM WNPOP LEFT JOIN pop2012 ON upcase(strip(WNPOP.State_Name_All))=upcase(strip(pop2012.State_Name_All)) AND upcase(strip(WNPOP.County_Name_All))=upcase(strip(pop2012.County_Name_All));
QUIT;&lt;/PRE&gt;
&lt;P&gt;Specifically related to County names in different source files sometimes they will actually have the word "County" and sometimes not. So that is something to examine as well as "Ada" does not match "Ada County".&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jun 2024 06:08:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/930559#M366124</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-06-02T06:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL LEFT JOIN HAPPEND BUT NO VALUE IS SHOWN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/930573#M366128</link>
      <description>&lt;P&gt;The pop2012 fields used in the join have the suffix "_ALL": pop2012.Country_Name&lt;STRONG&gt;_All&lt;/STRONG&gt;&amp;nbsp;pop2012.State_Name&lt;STRONG&gt;_All&lt;/STRONG&gt; , but in the&amp;nbsp;picture,&amp;nbsp;the table "finalv13" has pop2012 FIELDS, WITHOUT SUFFIX "_ALL"!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mariangela86_0-1717363691702.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96919i3AAA866CA719C603/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mariangela86_0-1717363691702.png" alt="mariangela86_0-1717363691702.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Correct the name of the two fields in the join:&lt;/P&gt;&lt;P&gt;pop2012.Country_Name&lt;BR /&gt;pop2012.State_NAME&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Below an example code with &lt;/SPAN&gt;&lt;SPAN&gt;alias for tables, with&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;upcase(converts all lowercase letters to uppercase letters) and compress(remove blanks) functions for variables:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc sql;
CREATE TABLE FINALV3 AS
SELECT
t1.* ,
t2.State_NAME,
t2.County_Name, t2.POP_2012
FROM&amp;nbsp;WNPOP t1&amp;nbsp;LEFT JOIN&amp;nbsp;pop2012 t2
ON
compress(upcase(t1.State_Name_All))=compress(upcase(t2.State_NAME)) AND
compress(upcase(t1.County_Name_All))=compress(upcase(t2.County_Name));
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jun 2024 21:34:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/930573#M366128</guid>
      <dc:creator>mariangela86</dc:creator>
      <dc:date>2024-06-02T21:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL LEFT JOIN HAPPEND BUT Most VALUE IS SHOWN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/937984#M368490</link>
      <description>&lt;P&gt;I am having trouble to know why my syntax not working properly. I am using a left join to join two tables based on 2 mutual coloumn ( Fipscode &amp;amp; Datetime) I made sure these two columns formatting are same before merging and here is my syntax:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE pamspi AS SELECT FROM PAMV1 LEFT JOIN spi12 ON pamV1.FIPScode=spi12.FIPScode AND pamv1.Datetime=spi12.Datetime;&lt;BR /&gt;QUIT;&lt;BR /&gt;proc print data=pamspi;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE pamspi AS SELECT * FROM PAMV1 LEFT JOIN spi12 ON pamV1.FIPScode=spi12.FIPScode AND pamv1.Datetime=spi12.Datetime;
QUIT;
proc print data=pamspi;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and here is what happens:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-08-01 122943.jpg" style="width: 693px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98960i528DF94DEED04F0F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-08-01 122943.jpg" alt="Screenshot 2024-08-01 122943.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see out of 143 obs I was expecting to be merged only 4 rows values have been merged and all others are showing missing as above. any thoughts on this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 16:33:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/937984#M368490</guid>
      <dc:creator>raheleh22</dc:creator>
      <dc:date>2024-08-01T16:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL LEFT JOIN HAPPEND BUT Most VALUE IS SHOWN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/937989#M368491</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/419260"&gt;@raheleh22&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am having trouble to know why my syntax not working properly. I am using a left join to join two tables based on 2 mutual coloumn ( Fipscode &amp;amp; Datetime) I made sure these two columns formatting are same before merging and here is my syntax:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE pamspi AS SELECT FROM PAMV1 LEFT JOIN spi12 ON pamV1.FIPScode=spi12.FIPScode AND pamv1.Datetime=spi12.Datetime;&lt;BR /&gt;QUIT;&lt;BR /&gt;proc print data=pamspi;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE pamspi AS SELECT * FROM PAMV1 LEFT JOIN spi12 ON pamV1.FIPScode=spi12.FIPScode AND pamv1.Datetime=spi12.Datetime;
QUIT;
proc print data=pamspi;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and here is what happens:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-08-01 122943.jpg" style="width: 693px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98960i528DF94DEED04F0F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-08-01 122943.jpg" alt="Screenshot 2024-08-01 122943.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see out of 143 obs I was expecting to be merged only 4 rows values have been merged and all others are showing missing as above. any thoughts on this?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Very simple. You have only 4 matches.&lt;/P&gt;
&lt;P&gt;Maxim 3: Know Your Data. This includes all data types, formats, and&amp;nbsp;&lt;EM&gt;real&lt;/EM&gt; values.&lt;/P&gt;
&lt;P&gt;Are values left- or right-aligned (leading blanks!)?&lt;/P&gt;
&lt;P&gt;Do such codes have leading zeroes in one dataset, but not the other (could be the result if codes were stored as numbers along the way)?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 16:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-LEFT-JOIN-HAPPEND-BUT-NO-VALUE-IS-SHOWN/m-p/937989#M368491</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-08-01T16:49:20Z</dc:date>
    </item>
  </channel>
</rss>

