<?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 Importing budget price data as numeric variables. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Importing-budget-price-data-as-numeric-variables/m-p/545509#M8037</link>
    <description>&lt;P&gt;Hello!&lt;BR /&gt;&lt;BR /&gt;I am importing a space delimited txt file that has several columns, among them a column which contains budget prices written in the following format ($10,000,000). I want to import this file making sure that this column is treated as a numeric value. I wrote the following code, however when I print the code the values are incomplete and don't show the full value as provided in the source file.&lt;BR /&gt;&lt;BR /&gt;This is what is included in the source txt file.&amp;nbsp;&lt;BR /&gt;Numbers provided in this image include $1,344,000 ; $2,100,000 ; $2,000,000 ; $0 ; $1,400,000 .&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="SAS Example.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/28145i2CB8151ABDA07F5D/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS Example.png" alt="SAS Example.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I made:&lt;BR /&gt;&lt;BR /&gt;DATA File;&lt;BR /&gt;INFILE '/folders/myfolders/sasuser.v94/File.txt' DSD DLM=' ' FIRSTOBS=2;&lt;BR /&gt;INPUT infodate :ANYDTDTE10. infotime infoyear info1 :$50. &lt;STRONG&gt;budget $&lt;/STRONG&gt; info2 info3 info4 info5 info6 info7;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC PRINT DATA=File;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I bolded the variable in question to make it easier for you to see what I did specifically.&lt;BR /&gt;&lt;BR /&gt;These are the outputs I got from the PRINT Output.&lt;BR /&gt;&lt;STRONG&gt;NOTE: there is code I didn't include that actually ordered all the budget data from highest to lowest.&lt;/STRONG&gt;&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="SAS Error 2.png" style="width: 82px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/28146iDDB5B4E61861A2EA/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS Error 2.png" alt="SAS Error 2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any and all help is appreciated!&lt;BR /&gt;&lt;BR /&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Sat, 23 Mar 2019 17:50:49 GMT</pubDate>
    <dc:creator>daft22</dc:creator>
    <dc:date>2019-03-23T17:50:49Z</dc:date>
    <item>
      <title>Importing budget price data as numeric variables.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Importing-budget-price-data-as-numeric-variables/m-p/545509#M8037</link>
      <description>&lt;P&gt;Hello!&lt;BR /&gt;&lt;BR /&gt;I am importing a space delimited txt file that has several columns, among them a column which contains budget prices written in the following format ($10,000,000). I want to import this file making sure that this column is treated as a numeric value. I wrote the following code, however when I print the code the values are incomplete and don't show the full value as provided in the source file.&lt;BR /&gt;&lt;BR /&gt;This is what is included in the source txt file.&amp;nbsp;&lt;BR /&gt;Numbers provided in this image include $1,344,000 ; $2,100,000 ; $2,000,000 ; $0 ; $1,400,000 .&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="SAS Example.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/28145i2CB8151ABDA07F5D/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS Example.png" alt="SAS Example.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I made:&lt;BR /&gt;&lt;BR /&gt;DATA File;&lt;BR /&gt;INFILE '/folders/myfolders/sasuser.v94/File.txt' DSD DLM=' ' FIRSTOBS=2;&lt;BR /&gt;INPUT infodate :ANYDTDTE10. infotime infoyear info1 :$50. &lt;STRONG&gt;budget $&lt;/STRONG&gt; info2 info3 info4 info5 info6 info7;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC PRINT DATA=File;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I bolded the variable in question to make it easier for you to see what I did specifically.&lt;BR /&gt;&lt;BR /&gt;These are the outputs I got from the PRINT Output.&lt;BR /&gt;&lt;STRONG&gt;NOTE: there is code I didn't include that actually ordered all the budget data from highest to lowest.&lt;/STRONG&gt;&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="SAS Error 2.png" style="width: 82px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/28146iDDB5B4E61861A2EA/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS Error 2.png" alt="SAS Error 2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any and all help is appreciated!&lt;BR /&gt;&lt;BR /&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Sat, 23 Mar 2019 17:50:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Importing-budget-price-data-as-numeric-variables/m-p/545509#M8037</guid>
      <dc:creator>daft22</dc:creator>
      <dc:date>2019-03-23T17:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: Importing budget price data as numeric variables.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Importing-budget-price-data-as-numeric-variables/m-p/545514#M8040</link>
      <description>&lt;P&gt;You can use the COMMA. informat, which will "ignore" the dollar sign and input the data as a number&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the dollar sign to re-appear on output, use the DOLLARw.d format.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Mar 2019 18:59:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Importing-budget-price-data-as-numeric-variables/m-p/545514#M8040</guid>
      <dc:creator>Norman21</dc:creator>
      <dc:date>2019-03-23T18:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Importing budget price data as numeric variables.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Importing-budget-price-data-as-numeric-variables/m-p/545520#M8044</link>
      <description>&lt;P&gt;You didn't define a length for your character variable BUDGET.&amp;nbsp; And you didn't give it any hints by including an informat with a width that SAS could use to guess what length to use, like you did for INFO1.&amp;nbsp; So BUDGET got created with a length of $8.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to read it as a NUMBER then use a numeric informat when reading it. The COMMA informat will ignore $ and commas and treat the resulting string as a number.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input infodate :anydtdte. infotime infoyear info1 :$50. budget :comma. info2-info7;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want the numbers to display with dollar signs and commas then attach the DOLLAR format to the variable. Either in this step or when you are outputting it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format budget dollar16.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note there is no need to specify a width on the informats when using list mode input.&amp;nbsp; The input statement will ignore the width specified and read all of the characters in the next value in the input stream.&amp;nbsp; The only reason you need the $50. informat for INFO1 is that you didn't define the variable before the INPUT statement so without any hints SAS will use default length of $8 for character variables.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Mar 2019 19:30:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Importing-budget-price-data-as-numeric-variables/m-p/545520#M8044</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-23T19:30:26Z</dc:date>
    </item>
  </channel>
</rss>

