<?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: Cannot join by the same key in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971997#M377425</link>
    <description>Thank you, Ksharp!&lt;BR /&gt;What means the 2d and 3d option (,,'kad') in compress(b.CD_PRODUIT,,'kad')?</description>
    <pubDate>Sat, 02 Aug 2025 09:45:03 GMT</pubDate>
    <dc:creator>SASdevAnneMarie</dc:creator>
    <dc:date>2025-08-02T09:45:03Z</dc:date>
    <item>
      <title>Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971964#M377416</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have an anormal join result, for example, the key L004IV is common, but the result of left join is empty. I tried left, compress, right option, but it doesn't work.&lt;/P&gt;
&lt;P&gt;My code is :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table ACCORD13_1 as select  a.*, b.* 
	from ACCORD2_q as a 
	    left join DONNEEMAQUETTE3_q as b on left(a.CD_PRODUIT)=left(b.CD_PRODUIT)
	;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The data is joined.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 01 Aug 2025 16:16:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971964#M377416</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2025-08-01T16:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971965#M377417</link>
      <description>&lt;P&gt;1) what does the LOG says?&lt;/P&gt;
&lt;P&gt;2) run proc contents on&amp;nbsp;ACCORD2_q and&amp;nbsp;DONNEEMAQUETTE3_q and share what you see.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Fri, 01 Aug 2025 16:45:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971965#M377417</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2025-08-01T16:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971966#M377418</link>
      <description>&lt;P&gt;OK, I think I got it.&lt;/P&gt;
&lt;P&gt;1) Run:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname=any;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;before you run that SQL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) naming a variable "Frais d'ahésion à l'assos" in SAS is rather silly idea...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Fri, 01 Aug 2025 16:50:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971966#M377418</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2025-08-01T16:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971982#M377419</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your message. I did this, but I still have an empty value for key L004IV :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data ACCORD2_q;
	set ACCORD2;
	rename 'Frais d''ahésion à l''assos'n=Frais_dadhesion;
	keep cd_produit 'Frais d''ahésion à l''assos'n;
run;

data  DONNEEMAQUETTE3_q;
	set DONNEEMAQUETTE3;
	keep  cd_produit Nbcar_arb Nbcar_cngmnt;
run;

options validvarname=any;

/***BASE FINALE***/
proc sql;
	create table ACCORD13_1 as select  a.*, b.* 
		from ACCORD2_q as a 
			left join DONNEEMAQUETTE3_q as b on left(a.CD_PRODUIT)=left(b.CD_PRODUIT)
	;
quit;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASdevAnneMarie_0-1754071832680.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108763iE669108B0196141F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASdevAnneMarie_0-1754071832680.png" alt="SASdevAnneMarie_0-1754071832680.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Aug 2025 18:11:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971982#M377419</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2025-08-01T18:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971989#M377420</link>
      <description>&lt;P&gt;Maxim 3: Know Your Data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Whenever you have such issues, look what's really in there.&lt;/P&gt;
&lt;P&gt;First, I filtered your datasets for the problematic key and found that it's mssing in donnemarquette.&lt;/P&gt;
&lt;P&gt;Then, I looked at the hex codes:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data check_b;
set DONNEEMAQUETTE3_q;
checkvar = put(cd_produit,$hex16.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and, lo and behold, in the failing keys there's a hidden 0D0A in the last two characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Aug 2025 20:17:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971989#M377420</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-08-01T20:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971990#M377421</link>
      <description>Thank you Kurt!  Did you use the notepad to see the hidden 0D0A?</description>
      <pubDate>Fri, 01 Aug 2025 21:45:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971990#M377421</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2025-08-01T21:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971994#M377422</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you Kurt! Did you use the notepad to see the hidden 0D0A?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No. Just look at the check dataset in SAS, it contains a variable where the hex codes are displayed.&lt;/P&gt;
&lt;P&gt;Alternatively, you can assign a $HEX format to the variable in question.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Aug 2025 06:04:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971994#M377422</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-08-02T06:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971995#M377423</link>
      <description>&lt;P&gt;Kurt was right. You has '0D0A'x characters at the end of variable 'CD_PRODUIT' in dataset 'DONNEEMAQUETTE3_q' .&lt;/P&gt;
&lt;PRE&gt;54   data x1;
55    set ACCORD2_q;
56    if compress(CD_PRODUIT,,'kad')='L004IV';
57    put CD_PRODUIT $hex32.;
58   run;

4C3030344956&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;2020&lt;/STRONG&gt;&lt;/FONT&gt;



59   data x2;
60    set DONNEEMAQUETTE3_q;
61    if compress(CD_PRODUIT,,'kad')='L004IV';
62     put CD_PRODUIT $hex32.;
63   run;

4C3030344956&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;0D0A

&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;Therefore, you need to use function COMPRESS to get rid of these characters:&lt;/P&gt;
&lt;PRE&gt;proc sql;
	create table ACCORD13_1 as select  a.*, b.* 
	from ACCORD2_q as a 
	    left join DONNEEMAQUETTE3_q as b on &lt;STRONG&gt;compress(a.CD_PRODUIT,,'kad')=compress(b.CD_PRODUIT,,'kad')&lt;/STRONG&gt;
	;
quit;&lt;/PRE&gt;</description>
      <pubDate>Sat, 02 Aug 2025 08:11:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971995#M377423</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-08-02T08:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971996#M377424</link>
      <description>And the real question is: how can these special characters contaminate your data?&lt;BR /&gt;Review your data sources and import processes.</description>
      <pubDate>Sat, 02 Aug 2025 09:31:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971996#M377424</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-08-02T09:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971997#M377425</link>
      <description>Thank you, Ksharp!&lt;BR /&gt;What means the 2d and 3d option (,,'kad') in compress(b.CD_PRODUIT,,'kad')?</description>
      <pubDate>Sat, 02 Aug 2025 09:45:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971997#M377425</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2025-08-02T09:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971998#M377426</link>
      <description>I don't know, I received this input file.</description>
      <pubDate>Sat, 02 Aug 2025 09:54:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971998#M377426</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2025-08-02T09:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971999#M377427</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I don't know, I received this input file.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It didn't fall right out of the sky, now did it?&lt;/P&gt;
&lt;P&gt;Somebody sent it to you, and that person must be notified that their process is broken. If you intend to be a professional, you can't let this go on.&lt;/P&gt;
&lt;P&gt;If you can't even trust their&amp;nbsp;&lt;STRONG&gt;key&lt;/STRONG&gt; values, why trust anything else?&lt;/P&gt;</description>
      <pubDate>Sat, 02 Aug 2025 11:18:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/971999#M377427</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-08-02T11:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/972000#M377428</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you, Ksharp!&lt;BR /&gt;What means the 2d and 3d option (,,'kad') in compress(b.CD_PRODUIT,,'kad')?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Maxim 1: Read the Documentation.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/n0fcshr0ir3h73n1b845c4aq58hz.htm" target="_blank" rel="noopener"&gt;COMPRESS Function&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See sections "&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/n0fcshr0ir3h73n1b845c4aq58hz.htm#p1cm6en3ihcusmn1u6x1ue6vyvcj" target="_blank" rel="noopener"&gt;characters&lt;/A&gt;" and "&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/n0fcshr0ir3h73n1b845c4aq58hz.htm#p0t37skg8o4cfgn166syt5boeofr" target="_blank" rel="noopener"&gt;modifiers&lt;/A&gt;".&lt;/P&gt;</description>
      <pubDate>Sat, 02 Aug 2025 11:21:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/972000#M377428</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-08-02T11:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/972002#M377429</link>
      <description>The  person copy and past values manually so it can’t be improved.</description>
      <pubDate>Sat, 02 Aug 2025 11:55:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/972002#M377429</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2025-08-02T11:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/972003#M377430</link>
      <description>Thank you, I did. I didn’t find «&amp;nbsp;kad&amp;nbsp;» modifier.</description>
      <pubDate>Sat, 02 Aug 2025 11:56:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/972003#M377430</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2025-08-02T11:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/972004#M377431</link>
      <description>It‘s a combination of the k, a and d modifier.</description>
      <pubDate>Sat, 02 Aug 2025 12:07:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/972004#M377431</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-08-02T12:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot join by the same key</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/972016#M377435</link>
      <description>Kurt already gave you the answer.&lt;BR /&gt;'kad' stands for Keep Alphabet Digit characters, and get rid of others characters.</description>
      <pubDate>Sun, 03 Aug 2025 05:19:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-join-by-the-same-key/m-p/972016#M377435</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-08-03T05:19:55Z</dc:date>
    </item>
  </channel>
</rss>

