<?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: Date with number data type in the datalines to create a dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-with-number-data-type-in-the-datalines-to-create-a-dataset/m-p/783537#M249854</link>
    <description>&lt;PRE&gt;data mbrtest;
&lt;FONT color="#FF6600"&gt;in&lt;/FONT&gt;format EffeDat&lt;FONT color="#FF6600"&gt;e&lt;/FONT&gt; mmddyy10.;
&lt;FONT color="#FF6600"&gt;format effeDate mmddyy10.;&lt;/FONT&gt;
Input Id EffeDate;
datalines;
1 12/11/2021
1 12/12/2021
;
Run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Ensure the variable has the correct spelling&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Use an &lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;IN&lt;/STRONG&gt;&lt;/FONT&gt;FORMAT to specify the current format so SAS knows how to read&lt;FONT color="#FF6600"&gt; IN&lt;/FONT&gt; the variable.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Use an FORMAT to apply a format, which controls the variable appearance&lt;/LI&gt;
&lt;LI&gt;Ensure a correct format is used, it's mmddyy - only two yy&lt;/LI&gt;
&lt;/UL&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I need to create a dataset and I want to enter it as a date in the dataset to mimic the real dataset.&lt;/P&gt;
&lt;P&gt;How can I change the code to get what I want:&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;BlueBlue&lt;/P&gt;
&lt;PRE&gt;data mbrtest;
Input Id EffeDate;
format EffeData mmddyyyy10.;
datalines;
1 12/11/2021
1 12/12/2021;
Run;

/*Date variable comes blank. How to resolve this issue? I have searched and I couldn't find any solution*/

&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Dec 2021 04:19:45 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-12-02T04:19:45Z</dc:date>
    <item>
      <title>Date with number data type in the datalines to create a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-with-number-data-type-in-the-datalines-to-create-a-dataset/m-p/783534#M249851</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I need to create a dataset and I want to enter it as a date in the dataset to mimic the real dataset.&lt;/P&gt;
&lt;P&gt;How can I change the code to get what I want:&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;BlueBlue&lt;/P&gt;
&lt;PRE&gt;data mbrtest;
Input Id EffeDate;
format EffeData mmddyyyy10.;
datalines;
1 12/11/2021
1 12/12/2021;
Run;

/*Date variable comes blank. How to resolve this issue? I have searched and I couldn't find any solution*/

&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Dec 2021 04:09:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-with-number-data-type-in-the-datalines-to-create-a-dataset/m-p/783534#M249851</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-12-02T04:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: Date with number data type in the datalines to create a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-with-number-data-type-in-the-datalines-to-create-a-dataset/m-p/783537#M249854</link>
      <description>&lt;PRE&gt;data mbrtest;
&lt;FONT color="#FF6600"&gt;in&lt;/FONT&gt;format EffeDat&lt;FONT color="#FF6600"&gt;e&lt;/FONT&gt; mmddyy10.;
&lt;FONT color="#FF6600"&gt;format effeDate mmddyy10.;&lt;/FONT&gt;
Input Id EffeDate;
datalines;
1 12/11/2021
1 12/12/2021
;
Run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Ensure the variable has the correct spelling&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Use an &lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;IN&lt;/STRONG&gt;&lt;/FONT&gt;FORMAT to specify the current format so SAS knows how to read&lt;FONT color="#FF6600"&gt; IN&lt;/FONT&gt; the variable.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Use an FORMAT to apply a format, which controls the variable appearance&lt;/LI&gt;
&lt;LI&gt;Ensure a correct format is used, it's mmddyy - only two yy&lt;/LI&gt;
&lt;/UL&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I need to create a dataset and I want to enter it as a date in the dataset to mimic the real dataset.&lt;/P&gt;
&lt;P&gt;How can I change the code to get what I want:&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;BlueBlue&lt;/P&gt;
&lt;PRE&gt;data mbrtest;
Input Id EffeDate;
format EffeData mmddyyyy10.;
datalines;
1 12/11/2021
1 12/12/2021;
Run;

/*Date variable comes blank. How to resolve this issue? I have searched and I couldn't find any solution*/

&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 04:19:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-with-number-data-type-in-the-datalines-to-create-a-dataset/m-p/783537#M249854</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-12-02T04:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Date with number data type in the datalines to create a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-with-number-data-type-in-the-datalines-to-create-a-dataset/m-p/783713#M249981</link>
      <description>&lt;P&gt;The log should have told you most of the problems:&lt;/P&gt;
&lt;PRE&gt;11   data mbrtest;
12   Input Id EffeDate;
13   format EffeData mmddyyyy10.;
                     -----------
                     484
NOTE 484-185: Format MMDDYYYY was not found or could not be loaded.

14   datalines;

NOTE: Variable EffeData is uninitialized.
NOTE: Invalid data for EffeDate in line 15 3-12.
RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+--
15         1 12/11/2021
Id=1 EffeDate=. EffeData=. _ERROR_=1 _N_=1
NOTE: Invalid data for EffeDate in line 16 3-12.
16         1 12/12/2021
Id=1 EffeDate=. EffeData=. _ERROR_=1 _N_=2
NOTE: The data set WORK.MBRTEST has 2 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


17   ;
18   Run;
&lt;/PRE&gt;
&lt;P&gt;First: do not place the ; at the end of datalines on a line with data, that causes an error.&lt;/P&gt;
&lt;P&gt;Your code did not provide any instructions on how to read Effedate so SAS assumes it is a simple numeric value. The / in the value means the values are not simple numbers and generate invalid data messages.&lt;/P&gt;
&lt;P&gt;The log tells you that the name of the Format you attempted to use is invalid. (Hint: None of the SAS supplied date formats/informats use YYYY in the name. Or at least I haven't see one yet.)&lt;/P&gt;
&lt;P&gt;The note that Effedat&lt;FONT color="#FF0000"&gt;a &lt;FONT color="#000000"&gt;is uninitialized should have been a clue that you have a spelling issue.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 17:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-with-number-data-type-in-the-datalines-to-create-a-dataset/m-p/783713#M249981</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-12-02T17:45:34Z</dc:date>
    </item>
  </channel>
</rss>

