<?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 Data Type Conversion in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-Type-Conversion/m-p/768993#M243935</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a variable which has value like 'XZ_VAC_901' in character format.&lt;/P&gt;&lt;P&gt;I have to convert this to numeric. Can anyone help ?&lt;/P&gt;</description>
    <pubDate>Wed, 22 Sep 2021 03:27:27 GMT</pubDate>
    <dc:creator>r3570</dc:creator>
    <dc:date>2021-09-22T03:27:27Z</dc:date>
    <item>
      <title>Data Type Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Type-Conversion/m-p/768993#M243935</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a variable which has value like 'XZ_VAC_901' in character format.&lt;/P&gt;&lt;P&gt;I have to convert this to numeric. Can anyone help ?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 03:27:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Type-Conversion/m-p/768993#M243935</guid>
      <dc:creator>r3570</dc:creator>
      <dc:date>2021-09-22T03:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: Data Type Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Type-Conversion/m-p/768994#M243936</link>
      <description>&lt;P&gt;Are they all this exact structure?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would use compress to remove anything but digits and then use compress. If you have decimal points this may not work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
length value_char $15.;
value_char= 'XZ_VAC_901';
value_numeric = input(compress(value_char, , 'kd'), 8.);
run;

proc print data=demo;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/382012"&gt;@r3570&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a variable which has value like 'XZ_VAC_901' in character format.&lt;/P&gt;
&lt;P&gt;I have to convert this to numeric. Can anyone help ?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 03:35:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Type-Conversion/m-p/768994#M243936</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-09-22T03:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Data Type Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Type-Conversion/m-p/768999#M243939</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My requirement was just to change the data type to numeric from character.&lt;/P&gt;&lt;P&gt;There is no requirement to separate out the numbers and characters.&lt;/P&gt;&lt;P&gt;I just need the variable type to be converted to numeric retaining the values in the variable as such.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;XZ_VAC_901 (char) to XZ_VAC_901 (num)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The whole table has the values in same format as provided in above example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you can help with that it would be great.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 04:05:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Type-Conversion/m-p/768999#M243939</guid>
      <dc:creator>r3570</dc:creator>
      <dc:date>2021-09-22T04:05:13Z</dc:date>
    </item>
    <item>
      <title>Data Type conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Type-Conversion/m-p/769001#M243945</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a variable which has value like 'XZ_VAC_901' in character format.&lt;BR /&gt;I have to convert this to numeric. Can anyone help ?&lt;BR /&gt;My requirement was just to change the data type to numeric from character.&lt;BR /&gt;There is no requirement to separate out the numbers and characters.&lt;BR /&gt;I just need the variable type to be converted to numeric retaining the values in the variable as such.&lt;BR /&gt;XZ_VAC_901 (char) to XZ_VAC_901 (num)&lt;BR /&gt;The whole table has the values in same format as provided in above example.&lt;BR /&gt;If anyone can help with this it would be great.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 04:44:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Type-Conversion/m-p/769001#M243945</guid>
      <dc:creator>r3570</dc:creator>
      <dc:date>2021-09-22T04:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Data Type Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Type-Conversion/m-p/769005#M243944</link>
      <description>&lt;P&gt;"XZ_VAC" is (very obviously) not a number, so this is not possible as such.&lt;/P&gt;
&lt;P&gt;If you have a limited, predefined scope of possible values, you could encode them in numbers and use a format to display the characters.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 05:32:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Type-Conversion/m-p/769005#M243944</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-09-22T05:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Data Type conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Type-Conversion/m-p/769012#M243949</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/382012"&gt;@r3570&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a variable which has value like 'XZ_VAC_901' in character format.&lt;BR /&gt;I have to convert this to numeric. Can anyone help ?&lt;BR /&gt;My requirement was just to change the data type to numeric from character.&lt;BR /&gt;There is no requirement to separate out the numbers and characters.&lt;BR /&gt;I just need the variable type to be converted to numeric retaining the values in the variable as such.&lt;BR /&gt;XZ_VAC_901 (char) to XZ_VAC_901 (num)&lt;BR /&gt;The whole table has the values in same format as provided in above example.&lt;BR /&gt;If anyone can help with this it would be great.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;XZ_VAC are not numerals or digits so what you ask makes no sense whatsoever. Any character other than 123456789 and decimal, except in the case of E for exponential notation or ABCDEF for hexadecimal values, or ROMAN numerals where _ZA901 are not numerals) are not numbers. Period.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If someone has given you this requirement then ask them what the numeric value is.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 06:02:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Type-Conversion/m-p/769012#M243949</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-09-22T06:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Data Type conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Type-Conversion/m-p/769180#M244024</link>
      <description>By what rule? What should XZ_VAC_901 map to? What's the encoding system?</description>
      <pubDate>Wed, 22 Sep 2021 14:35:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Type-Conversion/m-p/769180#M244024</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-09-22T14:35:24Z</dc:date>
    </item>
  </channel>
</rss>

