<?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: Converting vaue types in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Converting-vaue-types/m-p/649413#M13754</link>
    <description>I believe this should be marked as the answer.</description>
    <pubDate>Thu, 21 May 2020 00:01:57 GMT</pubDate>
    <dc:creator>nwinkler</dc:creator>
    <dc:date>2020-05-21T00:01:57Z</dc:date>
    <item>
      <title>Converting vaue types</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Converting-vaue-types/m-p/595237#M13163</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im currently working on a project that requires a dashboard. However, during the data collection process, majority of the values are saved in string format where as i need certain values in numerical format. Is there a way for me to convert the values from string format to Integer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 02:20:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Converting-vaue-types/m-p/595237#M13163</guid>
      <dc:creator>DandarahZ</dc:creator>
      <dc:date>2019-10-10T02:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: Converting vaue types</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Converting-vaue-types/m-p/595240#M13165</link>
      <description>&lt;P&gt;On the surface it's easy to do, but you need to use a new variable name:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;newvar = input(oldvar, 8.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;A few additional considerations ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There may be a reason why the values were stored as strings.&amp;nbsp; For example, perhaps the data contains occasional instances of "N/A".&amp;nbsp; Those would give you a message about invalid numeric data if you attempt to convert them to numeric.&amp;nbsp; So you do have to decide what the outcome should be in that situation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the length of the character variables is more than $8, you may need to use a wider width, such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;newvar = input(oldvar, 16.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, if you must keep the original variable names for some reason, you could do it in this fashion:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   newvar = input(oldvar, 8.);
   drop oldvar;
   rename newvar = oldvar;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Unfortunately, you do need to add to the program for each variable that you want to process in this way.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 02:45:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Converting-vaue-types/m-p/595240#M13165</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-10-10T02:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Converting vaue types</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Converting-vaue-types/m-p/595301#M13175</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;If in VA tou can use functions like "TreatAs" and "Format" to change type. You will need to create calculated variables using these functions &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//Fredrik&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 09:53:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Converting-vaue-types/m-p/595301#M13175</guid>
      <dc:creator>FredrikE</dc:creator>
      <dc:date>2019-10-10T09:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Converting vaue types</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Converting-vaue-types/m-p/649413#M13754</link>
      <description>I believe this should be marked as the answer.</description>
      <pubDate>Thu, 21 May 2020 00:01:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Converting-vaue-types/m-p/649413#M13754</guid>
      <dc:creator>nwinkler</dc:creator>
      <dc:date>2020-05-21T00:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Converting vaue types</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Converting-vaue-types/m-p/650347#M13763</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285846"&gt;@DandarahZ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Although the preferable way is to handle this before uploading data to Visual Analytics, one can also handle this in VA directly. The correct &lt;STRONG&gt;Operator&lt;/STRONG&gt; is &lt;STRONG&gt;Parse&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture11.PNG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39956iE6D32B835FC1202B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture11.PNG" alt="Capture11.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;And here you can see how your new variable is truly a number. I left decimals there so it's easier to see the difference from Text.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture12.PNG" style="width: 348px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39877iCFEFF4BC7E134CE0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture12.PNG" alt="Capture12.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Sometimes the number is part of string with alphabets included such as A123 or Metal123. In these cases you can first apply &lt;STRONG&gt;Substring&lt;/STRONG&gt; Operator and then utilize &lt;STRONG&gt;Parse&lt;/STRONG&gt;. I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Petri&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 05:24:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Converting-vaue-types/m-p/650347#M13763</guid>
      <dc:creator>PetriRoine</dc:creator>
      <dc:date>2020-05-26T05:24:23Z</dc:date>
    </item>
  </channel>
</rss>

