<?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: How to import Sales column into SAS with data step? Lengths of sales values vary. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-Sales-column-into-SAS-with-data-step-Lengths-of/m-p/830763#M328284</link>
    <description>&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your prompt response. Your solution works.&lt;/P&gt;&lt;P&gt;There is a lot to learn for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sagum&lt;/P&gt;</description>
    <pubDate>Sun, 28 Aug 2022 03:56:49 GMT</pubDate>
    <dc:creator>roquesagum</dc:creator>
    <dc:date>2022-08-28T03:56:49Z</dc:date>
    <item>
      <title>How to import Sales column into SAS with data step? Lengths of sales values vary.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-Sales-column-into-SAS-with-data-step-Lengths-of/m-p/830761#M328282</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could somebody help me with this issue?&lt;/P&gt;&lt;P&gt;I am a SAS student working on an assignment which is a small project about customer distribution and deactivation. I am importing the raw data into SAS with data step.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The last column is &lt;STRONG&gt;Sales&lt;/STRONG&gt;. The length of sales values under this column vary from 5 to 7 in the format of $20.00, $105.12, and $1298.22. (Please see the attached file with a small fraction of the original data.) I want to import them into SAS in their original format including the dollar sign. After that, I will work on them for some analyses.&lt;/P&gt;&lt;P&gt;I tried different ways but all failed.&amp;nbsp; I think the issue is that I don't know how to deal with the different lengths of values under that column.&lt;/P&gt;&lt;P&gt;I am looking forward to your help.&lt;/P&gt;&lt;P&gt;Thank you very much.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sagum&lt;/P&gt;</description>
      <pubDate>Sun, 28 Aug 2022 02:43:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-Sales-column-into-SAS-with-data-step-Lengths-of/m-p/830761#M328282</guid>
      <dc:creator>roquesagum</dc:creator>
      <dc:date>2022-08-28T02:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to import Sales column into SAS with data step? Lengths of sales values vary.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-Sales-column-into-SAS-with-data-step-Lengths-of/m-p/830762#M328283</link>
      <description>&lt;P&gt;You don't "import" from a text file.&amp;nbsp; You just READ the text file.&amp;nbsp; There are no "different lengths" under that column.&amp;nbsp; SALES is always in columns 82 to 92 on every line for the file you shared.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the COMMA informat, just like you need to use the MMDDYY informat for the date fields.&amp;nbsp; You can use the&amp;nbsp;@ cursor motion command to position the cursor in the right place to read those strings that require informats.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile 'c:\downloads\partial raw data.txt' truncover ;
  input id $ 1-13 @15 date1 mmddyy10. @26 date2 mmddyy10. /* other variables */ @82 sales comma11. ;
  format date1 date2 yymmdd10. sales dollar11.2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;Obs         id               date1         date2          sales

  1    1176913194483    1999-06-20             .        $128.00
  2    1176914599423    1999-10-04    1999-10-15         $72.00
  3    1176951913656    2000-07-01             .        $593.00
  4    1176954000288    2000-05-30             .         $83.00
  5    1176969186303    2000-12-13             .            .
  6    1176991056273    1999-08-31    2000-09-18      $1,041.00
  7    1176991866552    2000-05-24             .            .
  8    1176992889500    2000-11-28             .         $72.00
  9    1177000067271    1999-12-23             .        $134.00
 10    1177010940613    1999-12-09             .         $11.00
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Aug 2022 03:42:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-Sales-column-into-SAS-with-data-step-Lengths-of/m-p/830762#M328283</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-28T03:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to import Sales column into SAS with data step? Lengths of sales values vary.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-Sales-column-into-SAS-with-data-step-Lengths-of/m-p/830763#M328284</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your prompt response. Your solution works.&lt;/P&gt;&lt;P&gt;There is a lot to learn for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sagum&lt;/P&gt;</description>
      <pubDate>Sun, 28 Aug 2022 03:56:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-Sales-column-into-SAS-with-data-step-Lengths-of/m-p/830763#M328284</guid>
      <dc:creator>roquesagum</dc:creator>
      <dc:date>2022-08-28T03:56:49Z</dc:date>
    </item>
  </channel>
</rss>

