<?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: Need to convert Text or character to Hexadecimal in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-to-convert-Text-or-character-to-Hexadecimal/m-p/489609#M127882</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class="login-bold"&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562" target="_self"&gt;KurtBremser&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;I apologize for my mistake.&amp;nbsp; I have missed the set statement. I thank you for the solution provided. It works fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;thanks a lot.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Thank you,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Pon1&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Aug 2018 14:22:43 GMT</pubDate>
    <dc:creator>Pon1</dc:creator>
    <dc:date>2018-08-24T14:22:43Z</dc:date>
    <item>
      <title>Need to convert Text or character to Hexadecimal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-convert-Text-or-character-to-Hexadecimal/m-p/489547#M127865</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to convert the characters to hexadecimal. Here you have an example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a variable named Model , where model= 3096-712 which is a string.&lt;/P&gt;&lt;P&gt;I need to assign it to a new variaable called V1_hex = '3096'x where it should take the first four characters of model.&lt;/P&gt;&lt;P&gt;Please help me with some solution.&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pon1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using this code&lt;/P&gt;&lt;P&gt;DATA MYDATA;&lt;BR /&gt;format V1_HA V2_CHA $Char8.;&lt;BR /&gt;V1_CHA='3096-712';&lt;BR /&gt;V2_CHA='3096-708';&lt;BR /&gt;run;&lt;BR /&gt;Data Outdata;&lt;BR /&gt;format V1_Hex V2_Hex $hex4.;&lt;BR /&gt;V1_Hex=put(Substr(V1_CHA,1,4),$hex4.);&lt;BR /&gt;V2_Hex=put(SubStr(V2_CHA,1,4),$hex4.);&lt;BR /&gt;run;&lt;BR /&gt;proc Print Data=outdata;&lt;BR /&gt;run&lt;BR /&gt;//*&lt;/P&gt;&lt;P&gt;I go the output as&lt;/P&gt;&lt;P&gt;.............................................&lt;/P&gt;&lt;P&gt;The SAS System&lt;BR /&gt;&lt;BR /&gt;Obs V1_Hex&amp;nbsp; V2_Hex&amp;nbsp; &amp;nbsp;V1_CHA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;V2_CHA&lt;BR /&gt;&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; F4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; F4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help me to code for abtaining the&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 10:54:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-convert-Text-or-character-to-Hexadecimal/m-p/489547#M127865</guid>
      <dc:creator>Pon1</dc:creator>
      <dc:date>2018-08-24T10:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need to convert Text or character to Hexadecimal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-convert-Text-or-character-to-Hexadecimal/m-p/489551#M127867</link>
      <description>&lt;P&gt;Use the input() function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA MYDATA;
format V1_CHA V2_CHA $Char8.;
V1_CHA='3096-712';
V2_CHA='3096-708';
run;

Data Outdata;
set mydata;
format V1_Hex V2_Hex $hex4.;
V1_Hex = input(substr(V1_CHA,1,4),$hex4.);
V2_Hex = input(SubStr(V2_CHA,1,4),$hex4.);
run;

proc print data=outdata noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;V1_CHA      V2_CHA      V1_Hex    V2_Hex

3096-712    3096-708     3096      3096 
&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Aug 2018 11:21:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-convert-Text-or-character-to-Hexadecimal/m-p/489551#M127867</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-24T11:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Need to convert Text or character to Hexadecimal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-convert-Text-or-character-to-Hexadecimal/m-p/489569#M127872</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class="login-bold"&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562" target="_self"&gt;KurtBremser&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Greetings!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Thank you, for immediate response. I used the above code and got the result as&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;The SAS System&lt;BR /&gt;&lt;BR /&gt;V1_Hex&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; V2_Hex&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;V1_CHA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;V2_CHA&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;&lt;BR /&gt;4040&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4040&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;I not able to see the actual characters as output. for V1_CHA and V2_CHA also the hexadecimal values.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 12:58:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-convert-Text-or-character-to-Hexadecimal/m-p/489569#M127872</guid>
      <dc:creator>Pon1</dc:creator>
      <dc:date>2018-08-24T12:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Need to convert Text or character to Hexadecimal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-convert-Text-or-character-to-Hexadecimal/m-p/489571#M127874</link>
      <description>&lt;P&gt;Please run my code as posted. Your code misses the necessary set statement. You can see this in the log, it will complain about uninitialized variables.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 13:02:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-convert-Text-or-character-to-Hexadecimal/m-p/489571#M127874</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-24T13:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: Need to convert Text or character to Hexadecimal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-convert-Text-or-character-to-Hexadecimal/m-p/489609#M127882</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class="login-bold"&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562" target="_self"&gt;KurtBremser&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;I apologize for my mistake.&amp;nbsp; I have missed the set statement. I thank you for the solution provided. It works fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;thanks a lot.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Thank you,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Pon1&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 14:22:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-convert-Text-or-character-to-Hexadecimal/m-p/489609#M127882</guid>
      <dc:creator>Pon1</dc:creator>
      <dc:date>2018-08-24T14:22:43Z</dc:date>
    </item>
  </channel>
</rss>

