<?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: SAS Base Date and Variables not populating in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589830#M168754</link>
    <description>&lt;P&gt;Also some of the text fields seem to have UTF-8 characters which will throw off the column counts.&lt;/P&gt;
&lt;P&gt;It is not a good idea to try to create a fixed column file using characters that take a varying number of bytes per character.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Sep 2019 20:57:08 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-09-18T20:57:08Z</dc:date>
    <item>
      <title>SAS Base Date and Variables not populating</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589750#M168723</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS question.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32573i4661E8BBE6BE6878/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS question.PNG" alt="SAS question.PNG" /&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attached a screenshot of my question, code and results above. The data I'm working with is a Space Delimited file. I'd like to provide some additional code that I've written that's also resulted in the same error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data SwineFlu2009;&lt;BR /&gt;infile 'SwineFlu2009';&lt;BR /&gt;input idno 1-4 continent 13-18 country $ 27-59 date1 anydtdte10.60-70 num1 73-84 num2 86-93 num3 94-105 num4 106-115 num5 117-125&lt;BR /&gt;num6 126-135 num7 137-146 num8 149-156 date2 anydtdte32. 162-175 may 180-192 june 193-206 july 207-216 august 217-227&lt;BR /&gt;september 228-237 october 238-248 nov 250-259 dec 260-265;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 17:34:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589750#M168723</guid>
      <dc:creator>shreyasc</dc:creator>
      <dc:date>2019-09-18T17:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Base Date and Variables not populating</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589751#M168724</link>
      <description>&lt;P&gt;Obviously, nothing is showing up in DATE2 because either&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Your RAW data does not have anything that resembles a date that SAS can figure out in that field&lt;/LI&gt;
&lt;LI&gt;Your RAW data is missing in that field.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please examine your raw data file and see what is there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, we would prefer that type your message into the reply box, we don't need screen captures of text. SAS code should be pasted into the box that appears when you click on the running man icon. Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 18:23:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589751#M168724</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-18T18:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Base Date and Variables not populating</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589757#M168726</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The RAW file has the date populated as YYYY-MM-DD (for example, 2009-08-23). There are, I believe, just one or two missing values, but apart from that the dates are populated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there some obvious mistake in my code? Also, can you make out why the may-dec fields aren't being populated?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For context, I've attached my raw dataset with this message (it's very small since it's for learning purposes).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And thank you for information on formatting questions for this board. This was my first post, so not too familiar -- thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 18:08:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589757#M168726</guid>
      <dc:creator>shreyasc</dc:creator>
      <dc:date>2019-09-18T18:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Base Date and Variables not populating</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589773#M168728</link>
      <description>&lt;P&gt;Columns 162-175 do not contain anything recognizable as a date.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 18:32:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589773#M168728</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-18T18:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Base Date and Variables not populating</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589817#M168746</link>
      <description>&lt;P&gt;Is this the code you actually ran?&amp;nbsp; Didn't it produce errors?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data SwineFlu2009;
  infile 'SwineFlu2009';
  input
 idno 1-4
 continent 13-18
 country $ 27-59
 date1 anydtdte10.60-70
 num1 73-84
 num2 86-93
 num3 94-105
 num4 106-115
 num5 117-125
 num6 126-135
 num7 137-146
 num8 149-156
 date2 anydtdte32. 162-175
 may 180-192
 june 193-206
 july 207-216
 august 217-227
 september 228-237
 october 238-248
 nov 250-259
 dec 260-265
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Why do you have those two numbers separated by hyphens after the informat for date1 and date2.&amp;nbsp;Also does date2 really take up 32 columns in your fixed column file?&amp;nbsp; That seems like way too many for a date value.&amp;nbsp; You probably want something more like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;...
 @ 60 date1 anydtdte11.
...
 @162 date2 anydtdte14. 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Sep 2019 19:55:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589817#M168746</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-09-18T19:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Base Date and Variables not populating</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589820#M168749</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Why do you have those two numbers separated by hyphens after the informat for date1 and date2.&amp;nbsp;Also does date2 really take up 32 columns in your fixed column file?&amp;nbsp; That seems like way too many for a date value.&amp;nbsp; You probably want something more like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;...
 @ 60 date1 anydtdte11.
...
 @162 date2 anydtdte14. 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That would be fine and should work, except there is no date starting in column 162 in this data set, which needs to be fixed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But yes, the LOG should contain errors which ought to also indicate the problem.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 20:01:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589820#M168749</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-18T20:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Base Date and Variables not populating</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589830#M168754</link>
      <description>&lt;P&gt;Also some of the text fields seem to have UTF-8 characters which will throw off the column counts.&lt;/P&gt;
&lt;P&gt;It is not a good idea to try to create a fixed column file using characters that take a varying number of bytes per character.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 20:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589830#M168754</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-09-18T20:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Base Date and Variables not populating</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589836#M168757</link>
      <description>&lt;P&gt;Running your code example:&lt;/P&gt;
&lt;PRE&gt;1764  data junk;
1765  input idno 1-4 continent 13-18 country $ 27-59 date1 anydtdte10.60-70 num1 73-84 num2 86-93
                                                                         --
                                                                         22
                                                                         76
1765! num3 94-105 num4 106-115 num5 117-125
ERROR 22-322: Syntax error, expecting one of the following: C, L, R.

&lt;/PRE&gt;
&lt;P&gt;This reads your text except for a couple of dates that I'm not going to try to figure out. I suspect that you may have more columns that aren't referenced correctly since your date starts were both off apparently.&lt;/P&gt;
&lt;PRE&gt;data junk;
input idno 1-4 continent 13-18 country $ 27-59 @61 date1 yymmdd10. num1 73-84 num2 86-93 num3 94-105 num4 106-115 num5 117-125
num6 126-135 num7 137-146 num8 149-156 @169 date2  yymmdd10.  may 180-192 june 193-206 july 207-216 august 217-227
september 228-237 october 238-248 nov 250-259 dec 260-265;
&lt;/PRE&gt;
&lt;P&gt;Fixed column input does not allow you to specify the informat as you attempt for the date with columns and an informat. You could specify the columns and have an INFORMAT or ATTRIBUTE statement prior to the input to specify the informat or if your column usage lines up correctly skip the columns and use the informat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 21:10:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Date-and-Variables-not-populating/m-p/589836#M168757</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-18T21:10:46Z</dc:date>
    </item>
  </channel>
</rss>

