<?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 Field Width in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Field-Width/m-p/582612#M165740</link>
    <description>&lt;P&gt;I've got a query that is pulling back 30 million or so rows.&amp;nbsp; It's working, but the issue is there is a macro that is searching through the first 10,000 rows to determine the width of each field.&amp;nbsp; Unfortunately I have some fields that are all blank for the first 10,000 records, but have values afterwards.&amp;nbsp; These are set to size 1$, which is causing issues.&amp;nbsp; I tried sorting on the small field, but then another has the same issue.&amp;nbsp; My thought is to change the blank value to 9999999, so it's wide enough to work, then later take these back to 0.&amp;nbsp; I'm getting an error doing this.&amp;nbsp; Here's the code I'm trying:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF WRITPREM = . THEN DO;&lt;/P&gt;&lt;P&gt;WRITPREM = 9999999;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;ELSE WRITPREM&lt;/P&gt;&lt;P&gt;AS WRITPREM;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help or ideas.&lt;/P&gt;</description>
    <pubDate>Tue, 20 Aug 2019 21:54:18 GMT</pubDate>
    <dc:creator>johnhinton</dc:creator>
    <dc:date>2019-08-20T21:54:18Z</dc:date>
    <item>
      <title>Field Width</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Field-Width/m-p/582612#M165740</link>
      <description>&lt;P&gt;I've got a query that is pulling back 30 million or so rows.&amp;nbsp; It's working, but the issue is there is a macro that is searching through the first 10,000 rows to determine the width of each field.&amp;nbsp; Unfortunately I have some fields that are all blank for the first 10,000 records, but have values afterwards.&amp;nbsp; These are set to size 1$, which is causing issues.&amp;nbsp; I tried sorting on the small field, but then another has the same issue.&amp;nbsp; My thought is to change the blank value to 9999999, so it's wide enough to work, then later take these back to 0.&amp;nbsp; I'm getting an error doing this.&amp;nbsp; Here's the code I'm trying:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF WRITPREM = . THEN DO;&lt;/P&gt;&lt;P&gt;WRITPREM = 9999999;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;ELSE WRITPREM&lt;/P&gt;&lt;P&gt;AS WRITPREM;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help or ideas.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 21:54:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Field-Width/m-p/582612#M165740</guid>
      <dc:creator>johnhinton</dc:creator>
      <dc:date>2019-08-20T21:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Field Width</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Field-Width/m-p/582618#M165745</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285935"&gt;@johnhinton&lt;/a&gt;:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Your field in question is apparently character, and yet you're testing for a standard numeric missing value and assigning the numeric value 9999999 to it.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Your syntax is wrong: The DATA step language doesn't know what AS in this context means.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Simply code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;IF cmiss (WRITPREM) THEN WRITPREM = "9999999" ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And on the way back, you'd have to change WRITPREM back to blanks, not to 0, i.e. WRITPREM="".&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Apropos, whoever has written the macro you've mentioned should have accounted for this kind of eventuality in the macro code instead of making assumptions about data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;Paul D.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 22:10:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Field-Width/m-p/582618#M165745</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2019-08-20T22:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Field Width</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Field-Width/m-p/582620#M165746</link>
      <description>&lt;P&gt;Where are you pulling the data from that requires you to specify the field length or types?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyone making a 30 million row text file would have access to the record layout.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285935"&gt;@johnhinton&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I've got a query that is pulling back 30 million or so rows.&amp;nbsp; It's working, but the issue is there is a macro that is searching through the first 10,000 rows to determine the width of each field.&amp;nbsp; Unfortunately I have some fields that are all blank for the first 10,000 records, but have values afterwards.&amp;nbsp; These are set to size 1$, which is causing issues.&amp;nbsp; I tried sorting on the small field, but then another has the same issue.&amp;nbsp; My thought is to change the blank value to 9999999, so it's wide enough to work, then later take these back to 0.&amp;nbsp; I'm getting an error doing this.&amp;nbsp; Here's the code I'm trying:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF WRITPREM = . THEN DO;&lt;/P&gt;
&lt;P&gt;WRITPREM = 9999999;&lt;/P&gt;
&lt;P&gt;END;&lt;/P&gt;
&lt;P&gt;ELSE WRITPREM&lt;/P&gt;
&lt;P&gt;AS WRITPREM;&lt;/P&gt;
&lt;P&gt;END;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for any help or ideas.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 22:12:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Field-Width/m-p/582620#M165746</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-20T22:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: Field Width</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Field-Width/m-p/582849#M165853</link>
      <description>&lt;P&gt;How many of these data sets do you have??? And are your repeatedly running the same macro against the same data set? If so why?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the purpose is to determine the lengths of values stored one might ask why the length of the field is such that you don't already have a close idea of the size.&lt;/P&gt;
&lt;P&gt;And what do you do with that length information once you have it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would expect, as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;commented, that there should be some documentation that perhaps is not being properly utilized.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 15:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Field-Width/m-p/582849#M165853</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-08-21T15:10:19Z</dc:date>
    </item>
  </channel>
</rss>

