<?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: how do i merge value from same column? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694527#M211823</link>
    <description>&lt;P&gt;The you need to very carefully inspect the values that are actually stored in the dataset.&lt;/P&gt;
&lt;P&gt;Run&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
set import;
rel_hex = put(relationship,$hex30.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to see if you have any specialties in the strings (leading blanks, undisplayable characters).&lt;/P&gt;</description>
    <pubDate>Tue, 27 Oct 2020 12:17:20 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-10-27T12:17:20Z</dc:date>
    <item>
      <title>how do i merge value from same column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694482#M211804</link>
      <description>&lt;P&gt;the case is under "relationship" column, there are "Husband" and "Wife". i want to change "Husband" and "Wife" into "Married".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;UPDATE WORK.IMPORT&lt;BR /&gt;SET Relationship ='Married'&lt;BR /&gt;WHERE Relationship ='Husband';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i tried to do it like that, but then there is no rows updated.&lt;/P&gt;&lt;P&gt;please help me&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Hazim.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 10:42:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694482#M211804</guid>
      <dc:creator>HazimHasanB</dc:creator>
      <dc:date>2020-10-27T10:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: how do i merge value from same column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694491#M211809</link>
      <description>&lt;P&gt;Works for me:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Relationship :$20.;
datalines;
Married
Divorced
Unmarried
Husband
;

proc sql;
update have
  set Relationship ='Married'
  where Relationship ='Husband'
;
quit;

proc print data=have noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;Relationship
Married
Divorced
Unmarried
Married
&lt;/PRE&gt;
&lt;P&gt;Take care of spelling, Husband &amp;lt;&amp;gt; husband !&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 10:58:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694491#M211809</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-27T10:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: how do i merge value from same column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694497#M211811</link>
      <description>&lt;P&gt;yes i know it should be perfectly fine right, but here i tried it again but still no rows were updated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-10-27 at 7.17.49 PM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51107i47013EEA7811710B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2020-10-27 at 7.17.49 PM.png" alt="Screenshot 2020-10-27 at 7.17.49 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 11:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694497#M211811</guid>
      <dc:creator>HazimHasanB</dc:creator>
      <dc:date>2020-10-27T11:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: how do i merge value from same column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694499#M211812</link>
      <description>&lt;P&gt;Then it is in your data; please run&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=work.import;
run;

proc freq data=work.import;
tables relationship;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and post the results here.&lt;/P&gt;
&lt;P&gt;The above two steps are essential for Maxim 3: Know Your Data.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 11:31:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694499#M211812</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-27T11:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: how do i merge value from same column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694501#M211813</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-10-27 at 7.34.43 PM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51108iA47B33D47C5CB2A1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2020-10-27 at 7.34.43 PM.png" alt="Screenshot 2020-10-27 at 7.34.43 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 11:36:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694501#M211813</guid>
      <dc:creator>HazimHasanB</dc:creator>
      <dc:date>2020-10-27T11:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: how do i merge value from same column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694504#M211815</link>
      <description>&lt;P&gt;And PROC CONTENTS?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 11:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694504#M211815</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-27T11:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: how do i merge value from same column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694509#M211817</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-10-27 at 7.49.34 PM.png" style="width: 985px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51110i31744A4110807392/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2020-10-27 at 7.49.34 PM.png" alt="Screenshot 2020-10-27 at 7.49.34 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 11:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694509#M211817</guid>
      <dc:creator>HazimHasanB</dc:creator>
      <dc:date>2020-10-27T11:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: how do i merge value from same column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694527#M211823</link>
      <description>&lt;P&gt;The you need to very carefully inspect the values that are actually stored in the dataset.&lt;/P&gt;
&lt;P&gt;Run&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
set import;
rel_hex = put(relationship,$hex30.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to see if you have any specialties in the strings (leading blanks, undisplayable characters).&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2020 12:17:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694527#M211823</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-27T12:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: how do i merge value from same column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694734#M211889</link>
      <description>Or Try start with operator EQT .&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;update have&lt;BR /&gt;  set Relationship ='Married'&lt;BR /&gt;  where Relationship  eqt 'Husband'&lt;BR /&gt;;&lt;BR /&gt;quit;</description>
      <pubDate>Wed, 28 Oct 2020 05:00:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694734#M211889</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-10-28T05:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: how do i merge value from same column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694736#M211890</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/354025"&gt;@HazimHasanB&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-10-27 at 7.34.43 PM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51108iA47B33D47C5CB2A1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2020-10-27 at 7.34.43 PM.png" alt="Screenshot 2020-10-27 at 7.34.43 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;One thing you need to be aware of is Proc Freq, and many procedures, with display character values left justified and remove leading spaces. It may be that your "Husband" should be " Husband" or "&amp;nbsp; Husband" in a comparison.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;data junk;
   Relationship="            Husband";
run;

proc freq data=junk;
   tables relationship;
run;&lt;/PRE&gt;
&lt;P&gt;You might try&amp;nbsp; adding a variable with the length of the relationship to see if the displayed length matches the expected:&lt;/P&gt;
&lt;PRE&gt;data junk2;
   Relationship="            Husband";
   rlength=length(relationship);
run;

proc freq data=junk2;
   tables relationship*rlength/list ;
run;&lt;/PRE&gt;
&lt;P&gt;If you observe this behavior then you can use either Left or Strip function to remove the leading spaces.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 05:14:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694736#M211890</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-10-28T05:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: how do i merge value from same column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694974#M212002</link>
      <description>Thank you sir, found out there is actually a space behind every value.</description>
      <pubDate>Wed, 28 Oct 2020 18:09:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-merge-value-from-same-column/m-p/694974#M212002</guid>
      <dc:creator>HazimHasanB</dc:creator>
      <dc:date>2020-10-28T18:09:58Z</dc:date>
    </item>
  </channel>
</rss>

