<?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: importing data listed in billions of dollars in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/importing-data-listed-in-billions-of-dollars/m-p/625736#M35556</link>
    <description>&lt;P&gt;You mentioned that the values vary in length, but it does not look that way when I viewed your attached text file using this websites viewer tool.&amp;nbsp; The values of a given field are always in the same location on the line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why not just skip that column in your INPUT statement. Looks like you already know how to skip a column since you have included the +1 cursor movement command in your current INPUT statement.&lt;/P&gt;
&lt;P&gt;If the value is not always a B then read it as another character variable and then you can write a program to adjust the magnitude of the number read based on what letter was appended.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hint: You don't want to use the : modifier on your informats.&amp;nbsp; That will switch your input statement from formatted mode to list mode.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Feb 2020 01:20:02 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-02-19T01:20:02Z</dc:date>
    <item>
      <title>importing data listed in billions of dollars</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/importing-data-listed-in-billions-of-dollars/m-p/625733#M35555</link>
      <description>&lt;P&gt;Hi Everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Been learning for about a week. So, i have a data set that follows the following pattern:&lt;/P&gt;&lt;P&gt;rank (numeric), company ($), country ($), sales (num), profits (num), assets (num), market value (num)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the data under the last 4 numeric variables are presented in billions of dollars, as "$1.5B" or "$200.1B", and vary in length&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im using the following code:&lt;/P&gt;&lt;P&gt;DATA bigcos;&lt;BR /&gt;INFILE 'C:\Users\dlobsien\Documents\bigcompanies.txt';&lt;BR /&gt;INPUT ranking company_name $26. +1 country $18. sales_in_billions :dollar10. profits_in_billions :dollar10. assets_in_billions :dollar10. +1 profits_in_billions :dollar10.;&lt;BR /&gt;title companies data;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;——————————-&lt;/P&gt;&lt;P&gt;PROC PRINT data=bigcos (obs=15);&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the first three variables go in fine, but it wont read anything after that with the Bs in the way (i assume that's the issue). whenever i add a line that says "compress(var, 'B')", after the input lines it gives me 0 observations—maybe I'm entering the syntax wrong or putting it in the wrong spot.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've also included the data set in case that is useful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 00:53:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/importing-data-listed-in-billions-of-dollars/m-p/625733#M35555</guid>
      <dc:creator>Damon1</dc:creator>
      <dc:date>2020-02-19T00:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: importing data listed in billions of dollars</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/importing-data-listed-in-billions-of-dollars/m-p/625736#M35556</link>
      <description>&lt;P&gt;You mentioned that the values vary in length, but it does not look that way when I viewed your attached text file using this websites viewer tool.&amp;nbsp; The values of a given field are always in the same location on the line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why not just skip that column in your INPUT statement. Looks like you already know how to skip a column since you have included the +1 cursor movement command in your current INPUT statement.&lt;/P&gt;
&lt;P&gt;If the value is not always a B then read it as another character variable and then you can write a program to adjust the magnitude of the number read based on what letter was appended.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hint: You don't want to use the : modifier on your informats.&amp;nbsp; That will switch your input statement from formatted mode to list mode.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 01:20:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/importing-data-listed-in-billions-of-dollars/m-p/625736#M35556</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-19T01:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: importing data listed in billions of dollars</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/importing-data-listed-in-billions-of-dollars/m-p/625740#M35557</link>
      <description>&lt;P&gt;yeah, I'm not actually sure how to use the +1. i added on a whim it because i noticed it in a textbook, and added it one at a time because I think made the character variables read.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the data under the last 4 numeric variables vary from as short as $4.9B to as long as $2,265.8B, and each observation for those variables ends in "B"&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 01:23:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/importing-data-listed-in-billions-of-dollars/m-p/625740#M35557</guid>
      <dc:creator>Damon1</dc:creator>
      <dc:date>2020-02-19T01:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: importing data listed in billions of dollars</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/importing-data-listed-in-billions-of-dollars/m-p/625762#M35558</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/How-do-I-properly-use-PROC-IMPORT-for-a-multi-spaced-delimited/m-p/625656#M184421" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/How-do-I-properly-use-PROC-IMPORT-for-a-multi-spaced-delimited/m-p/625656#M184421&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Classmates?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to write your own informat preferably but you could also just read it as a character, remove the B and then convert it to billions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.lexjansen.com/pharmasug/2005/posters/po06.pdf" target="_blank"&gt;https://www.lexjansen.com/pharmasug/2005/posters/po06.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 02:34:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/importing-data-listed-in-billions-of-dollars/m-p/625762#M35558</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-02-19T02:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: importing data listed in billions of dollars</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/importing-data-listed-in-billions-of-dollars/m-p/625765#M35559</link>
      <description>&lt;P&gt;probably—its an online class so i couldnt tell you lmao.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i imported it as a character, then compressed out the $ and B then made a new data set and wrote varname=import(oldvar, best.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and that worked well enough&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 02:44:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/importing-data-listed-in-billions-of-dollars/m-p/625765#M35559</guid>
      <dc:creator>Damon1</dc:creator>
      <dc:date>2020-02-19T02:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: importing data listed in billions of dollars</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/importing-data-listed-in-billions-of-dollars/m-p/625773#M35560</link>
      <description>Include the leading spaces when counting how many characters the field takes.  So if the field before the one with B in it ends in column 20 and the B is in column 30 then use COMMA9. informat to read the 9 characters in columns 21 to 29.&lt;BR /&gt;... &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/78374"&gt;@21&lt;/a&gt; number comma9. letter $1. ...&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Feb 2020 03:26:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/importing-data-listed-in-billions-of-dollars/m-p/625773#M35560</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-19T03:26:00Z</dc:date>
    </item>
  </channel>
</rss>

