<?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 Read Money as numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Read-Money-as-numeric/m-p/444427#M111265</link>
    <description>&lt;P&gt;I am trying to change the format of column Gross, which contains values like&amp;nbsp;$50,319,942. I wish to make my program treat this variable as numeric.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code but it is not displaying the values of this column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA movies;&lt;BR /&gt;INFILE "/folders/myfolders/GrossDays.txt" DLM='09'x MISSOVER FIRSTOBS=2 DSD;&lt;BR /&gt;INPUT Title :$100. Date :ANYDTDTE20. Gross Theaters Distributor $;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;PROC PRINT DATA=movies;&lt;BR /&gt;FORMAT Date DATE9.;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;PROC PRINT DATA = music;&lt;BR /&gt;	FORMAT Date DATE. ;&lt;BR /&gt;	FORMAT Gross 10. ;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;DATA movies;&lt;BR /&gt;   SET movies;&lt;BR /&gt;   TheaterAvg = (Gross/Theaters);&lt;BR /&gt;RUN; &lt;BR /&gt;&lt;BR /&gt;PROC PRINT DATA = movies;&lt;BR /&gt;RUN;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 10 Mar 2018 18:56:38 GMT</pubDate>
    <dc:creator>Miah</dc:creator>
    <dc:date>2018-03-10T18:56:38Z</dc:date>
    <item>
      <title>Read Money as numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-Money-as-numeric/m-p/444427#M111265</link>
      <description>&lt;P&gt;I am trying to change the format of column Gross, which contains values like&amp;nbsp;$50,319,942. I wish to make my program treat this variable as numeric.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code but it is not displaying the values of this column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA movies;&lt;BR /&gt;INFILE "/folders/myfolders/GrossDays.txt" DLM='09'x MISSOVER FIRSTOBS=2 DSD;&lt;BR /&gt;INPUT Title :$100. Date :ANYDTDTE20. Gross Theaters Distributor $;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;PROC PRINT DATA=movies;&lt;BR /&gt;FORMAT Date DATE9.;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;PROC PRINT DATA = music;&lt;BR /&gt;	FORMAT Date DATE. ;&lt;BR /&gt;	FORMAT Gross 10. ;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;DATA movies;&lt;BR /&gt;   SET movies;&lt;BR /&gt;   TheaterAvg = (Gross/Theaters);&lt;BR /&gt;RUN; &lt;BR /&gt;&lt;BR /&gt;PROC PRINT DATA = movies;&lt;BR /&gt;RUN;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 18:56:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-Money-as-numeric/m-p/444427#M111265</guid>
      <dc:creator>Miah</dc:creator>
      <dc:date>2018-03-10T18:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: Read Money as numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-Money-as-numeric/m-p/444429#M111267</link>
      <description>&lt;P&gt;You just need to add an informat when inputting gross. e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;DATA movies;
  INFILE "/folders/myfolders/GrossDays.txt" DLM='09'x MISSOVER FIRSTOBS=2 DSD;
  INPUT Title :$100. Date :ANYDTDTE20. Gross dollar12. Theaters Distributor $;
RUN;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 19:14:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-Money-as-numeric/m-p/444429#M111267</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-03-10T19:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: Read Money as numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-Money-as-numeric/m-p/444430#M111268</link>
      <description>&lt;P&gt;Make sure to include the : prefix so that it uses list mode input since the source file is delimited and not fixed columns.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  INPUT Title :$100. Date :ANYDTDTE. Gross :dollar. Theaters Distributor :$20.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You don't need widths on your INFORMATs when using list mode, SAS will ignore them.&lt;/P&gt;
&lt;P&gt;But you do want to include the width in the $xx. informats since that way SAS can use the width the make a better guess at what length you want the character variables to use.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 19:20:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-Money-as-numeric/m-p/444430#M111268</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-03-10T19:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: Read Money as numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-Money-as-numeric/m-p/444432#M111270</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;: It works, in this case, with or without the : for gross as long as one includes the dollar. informat&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/194785"&gt;@Miah&lt;/a&gt;: One additional problem with your code:&lt;/P&gt;
&lt;PRE&gt;PROC PRINT DATA = music;
	FORMAT Date DATE. ;
	FORMAT Gross 10. ;
RUN;
&lt;/PRE&gt;
&lt;P&gt;Shouldn't that have been data = movies ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 19:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-Money-as-numeric/m-p/444432#M111270</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-03-10T19:23:58Z</dc:date>
    </item>
  </channel>
</rss>

