<?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: If is Numeric Convert to Numeric Else Character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709541#M218209</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Var" the list is in Text format.&lt;/P&gt;&lt;P&gt;Can i get the "Expected Result" as screenshot below?&lt;/P&gt;&lt;P&gt;1,2,3 is in General format, 2A, 2B is Character format. Result shown in single column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="allenpee_0-1609893782573.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53235i4F2A73A442BA0D12/image-size/medium?v=v2&amp;amp;px=400" role="button" title="allenpee_0-1609893782573.png" alt="allenpee_0-1609893782573.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jan 2021 00:47:45 GMT</pubDate>
    <dc:creator>User_Help</dc:creator>
    <dc:date>2021-01-06T00:47:45Z</dc:date>
    <item>
      <title>If is Numeric Convert to Numeric Else Character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709356#M218109</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a listing comprises of Numeric and Character, currently SAS recognized listing as character.&lt;/P&gt;&lt;P&gt;How to produce as numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Var&lt;/U&gt;&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;2A&lt;/P&gt;&lt;P&gt;2B&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF VTYPE(VAR)=’N’ THEN VAR1 = input(VAR,2.);&lt;BR /&gt;ELSE&amp;nbsp;VAR1 = PUT(VAR,2.);&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's wrong with the code?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2021 01:39:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709356#M218109</guid>
      <dc:creator>User_Help</dc:creator>
      <dc:date>2021-01-05T01:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: If is Numeric Convert to Numeric Else Character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709357#M218110</link>
      <description>&lt;P&gt;A variable can only be one type: numeric or character. This holds through every observation in the data set - otherwise how could you reliably code something like &lt;STRONG&gt;sumvar=var1+var2;&lt;/STRONG&gt;?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is most definitely NOT the same as a spreadsheet, where each cell can be of a different type than other cells in the same column (which is the analog of a variable).&amp;nbsp; That is an attribute of spreadsheets that has to be abandoned in SAS (or STATA or SPSS or other statistical packages).&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2021 01:55:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709357#M218110</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-01-05T01:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: If is Numeric Convert to Numeric Else Character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709358#M218111</link>
      <description>&lt;P&gt;If i would like to treat numeric as numeric, whereas character remains as character, can it be done?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2021 02:05:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709358#M218111</guid>
      <dc:creator>User_Help</dc:creator>
      <dc:date>2021-01-05T02:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: If is Numeric Convert to Numeric Else Character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709364#M218114</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/287538"&gt;@User_Help&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;If i would like to treat numeric as numeric, whereas character remains as character, can it be done?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;With two variables. Create a numeric variable for the values you want to treat as numeric.&lt;/P&gt;
&lt;P&gt;If you do not need to do calculations, add, subtract, multiply and so on, with a variable then it should not be numeric at all.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2021 02:48:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709364#M218114</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-05T02:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: If is Numeric Convert to Numeric Else Character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709366#M218116</link>
      <description>could share how is the formula likes? Thanks.</description>
      <pubDate>Tue, 05 Jan 2021 03:20:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709366#M218116</guid>
      <dc:creator>User_Help</dc:creator>
      <dc:date>2021-01-05T03:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: If is Numeric Convert to Numeric Else Character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709394#M218132</link>
      <description>&lt;P&gt;You want this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Var $;
cards;
1
2
2A
2B
3
;

data want;
 set have;
 var_num=input(var,?? best.);
 if missing(var_num) then var_char=var;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Jan 2021 11:35:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709394#M218132</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-01-05T11:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: If is Numeric Convert to Numeric Else Character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709541#M218209</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Var" the list is in Text format.&lt;/P&gt;&lt;P&gt;Can i get the "Expected Result" as screenshot below?&lt;/P&gt;&lt;P&gt;1,2,3 is in General format, 2A, 2B is Character format. Result shown in single column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="allenpee_0-1609893782573.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53235i4F2A73A442BA0D12/image-size/medium?v=v2&amp;amp;px=400" role="button" title="allenpee_0-1609893782573.png" alt="allenpee_0-1609893782573.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 00:47:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709541#M218209</guid>
      <dc:creator>User_Help</dc:creator>
      <dc:date>2021-01-06T00:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: If is Numeric Convert to Numeric Else Character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709542#M218210</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/287538"&gt;@User_Help&lt;/a&gt;&amp;nbsp; - Text Format and General Format are Excel concepts and have no meaning in SAS. From what I can see Column A and Column D are identical and all you are doing is changing the Excel format. You don't need SAS to do that. It's a lot easier just using Excel to format columns A and D.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 01:16:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709542#M218210</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-01-06T01:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: If is Numeric Convert to Numeric Else Character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709596#M218248</link>
      <description>NO. You can't .As SASKiwi mentioned , in SAS a column could be either character or numeric ,you can't have both in a column .</description>
      <pubDate>Wed, 06 Jan 2021 10:59:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-is-Numeric-Convert-to-Numeric-Else-Character/m-p/709596#M218248</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-01-06T10:59:55Z</dc:date>
    </item>
  </channel>
</rss>

