<?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: sas import excel give issue to convert numeric value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sas-import-excel-give-issue-to-convert-numeric-value/m-p/881075#M348152</link>
    <description>&lt;P&gt;Still comma became period when I tried to import the file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jun 2023 11:20:35 GMT</pubDate>
    <dc:creator>dht115</dc:creator>
    <dc:date>2023-06-16T11:20:35Z</dc:date>
    <item>
      <title>sas import excel give issue to convert numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-import-excel-give-issue-to-convert-numeric-value/m-p/880965#M348111</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do have excel file which contains number in string format. Column header name is with space and I want to import file in SAS and convert string to numeric by using input function or something similar. SAS variable name should be sas naming format (space remove by _).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;test name&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5,410.12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;565.56&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12,345.00&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc import out=test
datafile='C:\desktop\test.xlsx'
dbms=xlsx replace;
getnames=yes;
run;

data test;
set test;
test_name = input('test name'n, best12.);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I need to create something like following output:&amp;nbsp;&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="dht115_0-1686843989324.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/85026iFE8C95A7CA380567/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dht115_0-1686843989324.png" alt="dht115_0-1686843989324.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 15:47:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-import-excel-give-issue-to-convert-numeric-value/m-p/880965#M348111</guid>
      <dc:creator>dht115</dc:creator>
      <dc:date>2023-06-15T15:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: sas import excel give issue to convert numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-import-excel-give-issue-to-convert-numeric-value/m-p/880967#M348113</link>
      <description>&lt;P&gt;If the cells in the column in the Excel worksheet only contain numbers (whatever style is used to display them) then SAS will make a numeric variable from the column.&amp;nbsp; Otherwise SAS will be&amp;nbsp; forced to make a character variable so that it can hold the character cell values. Any cell that was a number will be converted to a digit string that represents the number in the cell (note this include dates).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you set the VALIDVARNAME=V7 option then SAS should automatically try to convert the column headers into valid SAS names.&amp;nbsp; It will only create variables with invalid names if you have (accidentally?) set the VALIDVARNAME option to ANY instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the COMMA informat to convert strings that contain commas, dollar signs and percent signs into numbers.&amp;nbsp; The INPUT() function does not care if width used on the informat specification is larger than the length of the string being read.&amp;nbsp; 32 is the maximum width that the COMMA informat can handle.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test_fixed;
  set test;
  test_name = input('test name'n, comma32.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS&amp;nbsp; BEST is the name of FORMAT, not an INFORMAT.&amp;nbsp; If you use it as an informat SAS will silently switch to using the normal numeric informat.&amp;nbsp; Just like if you accidentally use DOLLAR as the name of an informat it will switch to using the COMMA informat.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 15:59:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-import-excel-give-issue-to-convert-numeric-value/m-p/880967#M348113</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-15T15:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: sas import excel give issue to convert numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-import-excel-give-issue-to-convert-numeric-value/m-p/880969#M348115</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;option validvarname=v7;
proc import out=test
datafile='C:\desktop\test.xlsx'
dbms=xlsx replace;
getnames=yes;
run;

proc print data=test (obs=5) noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;What does that show?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 16:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-import-excel-give-issue-to-convert-numeric-value/m-p/880969#M348115</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-06-15T16:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: sas import excel give issue to convert numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-import-excel-give-issue-to-convert-numeric-value/m-p/881075#M348152</link>
      <description>&lt;P&gt;Still comma became period when I tried to import the file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 11:20:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-import-excel-give-issue-to-convert-numeric-value/m-p/881075#M348152</guid>
      <dc:creator>dht115</dc:creator>
      <dc:date>2023-06-16T11:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: sas import excel give issue to convert numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-import-excel-give-issue-to-convert-numeric-value/m-p/881080#M348154</link>
      <description>&lt;PRE&gt;proc import out=test
datafile='C:\data\test.xlsx'
dbms=xlsx replace;
getnames=yes;
run;

data test (drop = test_name_import);
set test (rename =(Test_name = test_name_import));
format test_name best12.;
test_name = input(test_name_import, comma32.);
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Jun 2023 11:43:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-import-excel-give-issue-to-convert-numeric-value/m-p/881080#M348154</guid>
      <dc:creator>HenryKobus</dc:creator>
      <dc:date>2023-06-16T11:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: sas import excel give issue to convert numeric value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-import-excel-give-issue-to-convert-numeric-value/m-p/881087#M348155</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/324991"&gt;@dht115&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Still comma became period when I tried to import the file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What does that mean?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you in some location where the convention is to use comma as the decimal point and period as the thousands group separators?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 13:00:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-import-excel-give-issue-to-convert-numeric-value/m-p/881087#M348155</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-16T13:00:53Z</dc:date>
    </item>
  </channel>
</rss>

