<?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: Issues reading tab-delimited file on z/os in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Issues-reading-tab-delimited-file-on-z-os/m-p/61249#M13301</link>
    <description>I'll look into that, thanks for the quick response, Scott.</description>
    <pubDate>Fri, 06 Aug 2010 13:00:48 GMT</pubDate>
    <dc:creator>DavidJ</dc:creator>
    <dc:date>2010-08-06T13:00:48Z</dc:date>
    <item>
      <title>Issues reading tab-delimited file on z/os</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issues-reading-tab-delimited-file-on-z-os/m-p/61246#M13298</link>
      <description>I have a tab-delimited file which was created in Excel 2007 under Windows which looks as follows (portion shown, tabs represented by a T)&lt;BR /&gt;
95008T	68106T	44970T	7001T 	&lt;BR /&gt;
95014T	100020T	54412T	2643T&lt;BR /&gt;
&lt;BR /&gt;
The file is uploaded to the mainframe and I have a SAS program which reads&lt;BR /&gt;
in the file as follows:&lt;BR /&gt;
&lt;BR /&gt;
filename census 'CENSUS.DATA' disp=shr;&lt;BR /&gt;
&lt;BR /&gt;
Data Census;&lt;BR /&gt;
     infile census dlm='05'X expandtabs missover lrecl=300&lt;BR /&gt;
&lt;BR /&gt;
     input zipcode $5.&lt;BR /&gt;
             median_income 8.&lt;BR /&gt;
             population 8.&lt;BR /&gt;
             pop_density 8.;&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
The code runs fine EXCEPT for lines where median_income is 100000 and higher (six digits vs.five).  For those lines, SAS then complains there is invalid data for the population field and truncates the median_income field (the value should be 100020)&lt;BR /&gt;
&lt;BR /&gt;
NOTE: Invalid data for population in line 143 14-21.                     &lt;BR /&gt;
RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6-- &lt;BR /&gt;
143       95014   100020  54412   2643    &lt;BR /&gt;
zipcode=95014 med_Income=10002 population=. pop_density=2643&lt;BR /&gt;
&lt;BR /&gt;
I have tried not using the expandtabs option and the file does not read in properly at all.</description>
      <pubDate>Fri, 06 Aug 2010 12:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issues-reading-tab-delimited-file-on-z-os/m-p/61246#M13298</guid>
      <dc:creator>DavidJ</dc:creator>
      <dc:date>2010-08-06T12:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Issues reading tab-delimited file on z/os</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issues-reading-tab-delimited-file-on-z-os/m-p/61247#M13299</link>
      <description>Suggest you dump the EXPANDTABS parameter, which is causing your $5 zip-code field to be expanded to $8, resulting in your data-truncation.  Otherwise, you will need to account for the adjusted field-width with each of your input data-source locations.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 06 Aug 2010 12:52:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issues-reading-tab-delimited-file-on-z-os/m-p/61247#M13299</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-08-06T12:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Issues reading tab-delimited file on z/os</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issues-reading-tab-delimited-file-on-z-os/m-p/61248#M13300</link>
      <description>Putting the lengths into a LENGTH statement might solve your problem.&lt;BR /&gt;
Ran the following (with your T delimiters) on z/OS batch:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
                                                              &lt;BR /&gt;
  Data Census;                                                &lt;BR /&gt;
  infile census dlm='T' expandtabs missover /*lrecl=300*/ ;   &lt;BR /&gt;
                                                              &lt;BR /&gt;
  length zipcode $5  median_income population pop_density 8 ; &lt;BR /&gt;
                                                              &lt;BR /&gt;
  input zipcode                                               &lt;BR /&gt;
        median_income                                         &lt;BR /&gt;
        population                                            &lt;BR /&gt;
        pop_density   ;                                       &lt;BR /&gt;
                                                              &lt;BR /&gt;
  run;                                                        &lt;BR /&gt;
                                                              &lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Robert</description>
      <pubDate>Fri, 06 Aug 2010 12:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issues-reading-tab-delimited-file-on-z-os/m-p/61248#M13300</guid>
      <dc:creator>Robert_Bardos</dc:creator>
      <dc:date>2010-08-06T12:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Issues reading tab-delimited file on z/os</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issues-reading-tab-delimited-file-on-z-os/m-p/61249#M13301</link>
      <description>I'll look into that, thanks for the quick response, Scott.</description>
      <pubDate>Fri, 06 Aug 2010 13:00:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issues-reading-tab-delimited-file-on-z-os/m-p/61249#M13301</guid>
      <dc:creator>DavidJ</dc:creator>
      <dc:date>2010-08-06T13:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Issues reading tab-delimited file on z/os</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issues-reading-tab-delimited-file-on-z-os/m-p/61250#M13302</link>
      <description>When I use a tab delimited file on the mainframe, I use LIST input and tell SAS the maximum length each variable can be.  If the length is shorter than the max, SAS will allow for it.  I code like this:&lt;BR /&gt;
Data Temp;&lt;BR /&gt;
  infile in dlm='05'x dsd trancover;&lt;BR /&gt;
  input v1   :   $45.&lt;BR /&gt;
          v2   :   $10.&lt;BR /&gt;
          v3   :     12.&lt;BR /&gt;
   etc                   ;&lt;BR /&gt;
&lt;BR /&gt;
The colon :  allows you to read the value from the next nonblank column until the pointer reaches the next blank column, in this case reading from tab to tab.</description>
      <pubDate>Fri, 06 Aug 2010 13:07:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issues-reading-tab-delimited-file-on-z-os/m-p/61250#M13302</guid>
      <dc:creator>garybald</dc:creator>
      <dc:date>2010-08-06T13:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Issues reading tab-delimited file on z/os</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issues-reading-tab-delimited-file-on-z-os/m-p/61251#M13303</link>
      <description>Sorry, I should have  TRUNCOVER instead of trancover</description>
      <pubDate>Fri, 06 Aug 2010 13:10:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issues-reading-tab-delimited-file-on-z-os/m-p/61251#M13303</guid>
      <dc:creator>garybald</dc:creator>
      <dc:date>2010-08-06T13:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: Issues reading tab-delimited file on z/os</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issues-reading-tab-delimited-file-on-z-os/m-p/61252#M13304</link>
      <description>hi DavidJ&lt;BR /&gt;
&lt;BR /&gt;
your best direction is coming from "garybald" &lt;BR /&gt;
 &lt;BR /&gt;
tab-delimited and csv-type data files have no fixed structure, as implied by explicit lengths on an input statement. &lt;BR /&gt;
To support these data types SAS data steps have the features  "list input" and DSD. &lt;BR /&gt;
It is DSD which has the biggest effect because "normal" list input would expect "white space" to be the "delimiter" between data items. For that way. multiple blanks are ignored and treated as "one delimiter". &lt;BR /&gt;
For DSD (I like to interpret as Delimiter Separated Data) each blank is a delimiter and consecutive delimiters imply a missing value. This DSD feature was introduced coinciding with the introduction of SAS on ms-windows platforms, so it is not really a new feature- but doesn't seem to be among  basic SAS training, judging by the number of discussions about how to handle delimiter separated data.&lt;BR /&gt;
 &lt;BR /&gt;
Any time you have to deal with delimited data (csv, tab or pipe or whatever) remember to use DSD.&lt;BR /&gt;
&lt;BR /&gt;
good luck&lt;BR /&gt;
peterC</description>
      <pubDate>Fri, 06 Aug 2010 13:32:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issues-reading-tab-delimited-file-on-z-os/m-p/61252#M13304</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-08-06T13:32:24Z</dc:date>
    </item>
  </channel>
</rss>

