<?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 Assign character variable based on list of existing variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Assign-character-variable-based-on-list-of-existing-variables/m-p/766491#M242924</link>
    <description>&lt;PRE&gt;data have;
id1 = 'uv223';
id2 = '';
mid = 'uv223';
new_id = put(id1,id2,mid,best12.);
run;&lt;/PRE&gt;
&lt;P&gt;I have a file similar to the above.&amp;nbsp; There are three possibilities for the same ID reference.&amp;nbsp; I want to assign the variable value, in this case 'uv223' to a new character variable called new_id.&amp;nbsp; In one of the id's there is no value however the other two do have the same value.&amp;nbsp; So new_id should equal 'uv223'.&amp;nbsp; As you can see I attempted to do this with a put statement but received an error&lt;/P&gt;</description>
    <pubDate>Tue, 07 Sep 2021 22:37:42 GMT</pubDate>
    <dc:creator>Q1983</dc:creator>
    <dc:date>2021-09-07T22:37:42Z</dc:date>
    <item>
      <title>Assign character variable based on list of existing variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-character-variable-based-on-list-of-existing-variables/m-p/766491#M242924</link>
      <description>&lt;PRE&gt;data have;
id1 = 'uv223';
id2 = '';
mid = 'uv223';
new_id = put(id1,id2,mid,best12.);
run;&lt;/PRE&gt;
&lt;P&gt;I have a file similar to the above.&amp;nbsp; There are three possibilities for the same ID reference.&amp;nbsp; I want to assign the variable value, in this case 'uv223' to a new character variable called new_id.&amp;nbsp; In one of the id's there is no value however the other two do have the same value.&amp;nbsp; So new_id should equal 'uv223'.&amp;nbsp; As you can see I attempted to do this with a put statement but received an error&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 22:37:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-character-variable-based-on-list-of-existing-variables/m-p/766491#M242924</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2021-09-07T22:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Assign character variable based on list of existing variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-character-variable-based-on-list-of-existing-variables/m-p/766493#M242925</link>
      <description>&lt;PRE&gt;data have;
id1 = 'uv223';
id2 = '';
mid = 'uv223';
new_id = coalescec(id1,id2,mid) ;
run;&lt;/PRE&gt;
&lt;P&gt;PUT() converts types.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you want to see as the output? My guess is you want the COALESCEC() function or possibly a CAT function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5629"&gt;@Q1983&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;data have;
id1 = 'uv223';
id2 = '';
mid = 'uv223';
new_id = put(id1,id2,mid,best12.);
run;&lt;/PRE&gt;
&lt;P&gt;I have a file similar to the above.&amp;nbsp; There are three possibilities for the same ID reference.&amp;nbsp; I want to assign the variable value, in this case 'uv223' to a new character variable called new_id.&amp;nbsp; In one of the id's there is no value however the other two do have the same value.&amp;nbsp; So new_id should equal 'uv223'.&amp;nbsp; As you can see I attempted to do this with a put statement but received an error&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 22:52:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-character-variable-based-on-list-of-existing-variables/m-p/766493#M242925</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-09-07T22:52:54Z</dc:date>
    </item>
  </channel>
</rss>

