<?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: add text to a variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/add-text-to-a-variable/m-p/709940#M218436</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Join on&amp;nbsp;&amp;nbsp; a.id = input(substr(b.id,4),12.)&lt;/P&gt;
&lt;P&gt;perhaps if meant join in Proc SQL, A would the set with the ID numeric and B the other set with the character ID. &lt;/P&gt;
&lt;P&gt;or build the string value with something like Cats('DM-',put(a.id,12. -L) ) = b.id&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jan 2021 16:00:28 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-01-07T16:00:28Z</dc:date>
    <item>
      <title>add text to a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-text-to-a-variable/m-p/709853#M218392</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question (probably an easy one).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I add text to a variable? It looks like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ID&lt;/P&gt;
&lt;P&gt;27693057&lt;/P&gt;
&lt;P&gt;20377519&lt;/P&gt;
&lt;P&gt;31679420&lt;/P&gt;
&lt;P&gt;02310259&lt;/P&gt;
&lt;P&gt;02148619&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can I have them to look like these:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ID&lt;/P&gt;
&lt;P&gt;DM-27693057&lt;/P&gt;
&lt;P&gt;DM-20377519&lt;/P&gt;
&lt;P&gt;DM-31679420&lt;/P&gt;
&lt;P&gt;DM-02310259&lt;/P&gt;
&lt;P&gt;DM-02148619&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A solution could also be to remove the 'DM-' part as I want to join two datasets. The numbers in each ID is identical, but I cant join them right now because of the 'DM-' part. The first variables (only numbers) is in format BEST12. while the variables with DM- is in the format $CHAR12.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/MM&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 08:51:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-text-to-a-variable/m-p/709853#M218392</guid>
      <dc:creator>Mikkel_madsen</dc:creator>
      <dc:date>2021-01-07T08:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: add text to a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-text-to-a-variable/m-p/709857#M218395</link>
      <description>&lt;P&gt;This is pretty easy to do. However, your actual problem seems to be another one. Can you provide a description of the 'join' problem? I think we can solve your actual problem as well &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 09:06:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-text-to-a-variable/m-p/709857#M218395</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-01-07T09:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: add text to a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-text-to-a-variable/m-p/709858#M218396</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data A_charID;
set A(rename=(ID=Old_ID));

length ID $ 12;

ID=cats('DM-', put(Old_ID,z8.));
run;

data B_numID;
set B(rename=(ID=Old_ID));

ID=input(substr(Old_ID,4), best12.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jan 2021 09:21:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-text-to-a-variable/m-p/709858#M218396</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2021-01-07T09:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: add text to a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-text-to-a-variable/m-p/709940#M218436</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Join on&amp;nbsp;&amp;nbsp; a.id = input(substr(b.id,4),12.)&lt;/P&gt;
&lt;P&gt;perhaps if meant join in Proc SQL, A would the set with the ID numeric and B the other set with the character ID. &lt;/P&gt;
&lt;P&gt;or build the string value with something like Cats('DM-',put(a.id,12. -L) ) = b.id&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 16:00:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-text-to-a-variable/m-p/709940#M218436</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-07T16:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: add text to a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-text-to-a-variable/m-p/710029#M218482</link>
      <description>&lt;P&gt;All of the above are viable.&amp;nbsp; Many ways to skin something.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have_A;
  input ID $8.;
  datalines;
27693057
20377519
31679420
02310259
02148619
;
run;

data have_B;
  input ID $11.;
  datalines;
DM-27693057
DM-20377519
DM-31679420
DM-02310259
DM-02148619
;
run;

data have_B_xformd/view=have_B_xformd;
  set have_B;
  ID_stub=substr(ID,4,8);
run;

proc sql;
  create table join_demo as 
    select a.ID as ID_a,
           b.ID as ID_b
      from have_a as a 
             join 
           have_B_xformd as b
             ON a.ID=b.ID_stub;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jan 2021 20:06:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-text-to-a-variable/m-p/710029#M218482</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-01-07T20:06:00Z</dc:date>
    </item>
  </channel>
</rss>

