<?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 format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345393#M79460</link>
    <description>&lt;DIV class="lia-message-heading lia-component-message-header"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="messagebodydisplay_0" class="lia-message-body"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;DIV&gt;Q1.I am running the below code snippets to get the b_date from Birth_Date&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;data birth;&lt;/DIV&gt;
&lt;DIV&gt;set credit card;&lt;/DIV&gt;
&lt;DIV&gt;b_date= input(Birth_Date,10.);&lt;/DIV&gt;
&lt;DIV&gt;format b_date date9.&lt;/DIV&gt;
&lt;DIV&gt;run;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Why for Birth_Date 01/08/1966, b_date = 22JAN1960 ?&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;Answer: The b_date is 22JAN1960 b/c that is the DATE9. format that you requested in the code. &amp;nbsp;You also need a semicolon (;) after DATE9.&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Wed, 29 Mar 2017 14:35:09 GMT</pubDate>
    <dc:creator>ccarel</dc:creator>
    <dc:date>2017-03-29T14:35:09Z</dc:date>
    <item>
      <title>Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345287#M79420</link>
      <description>&lt;DIV&gt;Q1.I am running the below code snippets to get the b_date from Birth_Date&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;data birth;&lt;/DIV&gt;&lt;DIV&gt;set credit card;&lt;/DIV&gt;&lt;DIV&gt;b_date= input(Birth_Date,10.);&lt;/DIV&gt;&lt;DIV&gt;format b_date date9.&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Why for Birth_Date 01/08/1966, b_date = 22JAN1960 ?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Q2. Running the below code Snippets.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;data birth;&lt;/DIV&gt;&lt;DIV&gt;set credit card;&lt;/DIV&gt;&lt;DIV&gt;b_date= input(Birth_Date,10.);&lt;/DIV&gt;&lt;DIV&gt;run:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Why for Birth_Date 01/08/1966, &amp;nbsp;b_date = 21?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Q3)&amp;nbsp;&lt;SPAN&gt;Running the below code Snippets.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;data birth;&lt;/DIV&gt;&lt;DIV&gt;set credit card;&lt;/DIV&gt;&lt;DIV&gt;b_date= put(Birth_Date,10.);&lt;/DIV&gt;&lt;DIV&gt;run:&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Why for Birth_Date 01/08/1966, &amp;nbsp;b_date = 2199?&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 29 Mar 2017 09:06:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345287#M79420</guid>
      <dc:creator>mrinmoy</dc:creator>
      <dc:date>2017-03-29T09:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345288#M79421</link>
      <description>&lt;P&gt;Can you provide some sample data?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 09:13:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345288#M79421</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-03-29T09:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345290#M79422</link>
      <description>&lt;P&gt;can you please try with the date which has been given in the question&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 09:21:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345290#M79422</guid>
      <dc:creator>mrinmoy</dc:creator>
      <dc:date>2017-03-29T09:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345291#M79423</link>
      <description>&lt;P&gt;You need to give us a sample of your datasets credit and card (as yout set statement adresses those two datasets).&lt;/P&gt;
&lt;P&gt;We need this to see the actual values and the variable types and attributes.&lt;/P&gt;
&lt;P&gt;Provide the data in a data step; a macro that converts your dataset to a data step for posting is found here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;When posting, use the "little running man" or {i} icons. These preserve formatting and prevent reformatting of supposed smileys etc.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 09:33:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345291#M79423</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-29T09:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345296#M79427</link>
      <description>&lt;P&gt;PFA for sample data set&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 10:04:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345296#M79427</guid>
      <dc:creator>mrinmoy</dc:creator>
      <dc:date>2017-03-29T10:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345302#M79431</link>
      <description>&lt;P&gt;The problem is that a csv file does not convey column attributes in any way, which are essential in getting the right answers.&lt;/P&gt;
&lt;P&gt;Or do you mean that you do not yet have a SAS dataset and need proper import code for the csv also?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 11:11:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345302#M79431</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-29T11:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345306#M79434</link>
      <description>&lt;P&gt;Board monitors,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps it's time to compare this to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/General-SAS-Programming/PUT-and-INPUT/m-p/345080#M44559https://communities.sas.com/t5/General-SAS-Programming/PUT-and-INPUT/m-p/345080#M44559" target="_blank"&gt;https://communities.sas.com/t5/General-SAS-Programming/PUT-and-INPUT/m-p/345080#M44559https://communities.sas.com/t5/General-SAS-Programming/PUT-and-INPUT/m-p/345080#M44559&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looks like there's a homework assignment here.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 10:34:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345306#M79434</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-29T10:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345320#M79443</link>
      <description>&lt;P&gt;Oh, yeah, some people need to get a grasp on the concept that homework assignments want to test THEIR brains, not OURS.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 11:10:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345320#M79443</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-29T11:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345321#M79444</link>
      <description>&lt;P&gt;The data set i have importeed correctly but I am not understanding why I am getting different out put while using put and input&amp;nbsp;&lt;/P&gt;&lt;P&gt;please help me on that&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 11:11:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345321#M79444</guid>
      <dc:creator>mrinmoy</dc:creator>
      <dc:date>2017-03-29T11:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345324#M79446</link>
      <description>&lt;P&gt;Show the code with which you imported the csv, so we can recreate your dataset.&lt;/P&gt;
&lt;P&gt;Or use the macro I previously mentioned to convert your dataset into a data step for posting here.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 11:19:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345324#M79446</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-29T11:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345393#M79460</link>
      <description>&lt;DIV class="lia-message-heading lia-component-message-header"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="messagebodydisplay_0" class="lia-message-body"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;DIV&gt;Q1.I am running the below code snippets to get the b_date from Birth_Date&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;data birth;&lt;/DIV&gt;
&lt;DIV&gt;set credit card;&lt;/DIV&gt;
&lt;DIV&gt;b_date= input(Birth_Date,10.);&lt;/DIV&gt;
&lt;DIV&gt;format b_date date9.&lt;/DIV&gt;
&lt;DIV&gt;run;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Why for Birth_Date 01/08/1966, b_date = 22JAN1960 ?&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;Answer: The b_date is 22JAN1960 b/c that is the DATE9. format that you requested in the code. &amp;nbsp;You also need a semicolon (;) after DATE9.&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 29 Mar 2017 14:35:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345393#M79460</guid>
      <dc:creator>ccarel</dc:creator>
      <dc:date>2017-03-29T14:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345490#M79481</link>
      <description>&lt;P&gt;Adding to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/58682"&gt;@ccarel&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The value of Birth_date apparently is already a SAS date value. Run proc contents on your data set and I bet you see Birth_date has Format mmddyy10.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you did with this code:&lt;/P&gt;
&lt;P&gt;b_date= input(Birth_date,10.);&lt;/P&gt;
&lt;P&gt;was ask SAS to convert the existing value of Birth_date to a string value that the INPUT function requires. The unformatted value of 08Jan1966 is 2199. When SAS does the requested conversion it uses the best12. format so the resulting string 12 characters long with a value of 8 blanks followed by 2199. Then you tell SAS to read that value with 10. format so it reads the first 10 characters. The only numerals there are 21 so the result is 21. When you format that as a date you get 22 Jan 1960 because 0 is 1 Jan 1960 and dates are number of days from 1 Jan 1960. So add 21 = 22 Jan 1960.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your value had actually been the string '01/08/1966' there would have been an error because that is not valid to read with the 10. informat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your log when you ran the code would have message about "Numeric values have been converted to character values at the places given by :&lt;/P&gt;
&lt;P&gt;(Line):(Column).&lt;/P&gt;
&lt;P&gt;the line and column shown would point to the location of Birth_date in the input function argument.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 18:20:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/345490#M79481</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-03-29T18:20:08Z</dc:date>
    </item>
  </channel>
</rss>

