<?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: Please help me to create sas date in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Please-help-me-to-create-sas-date/m-p/66325#M18937</link>
    <description>Hi:&lt;BR /&gt;
  Remember that the formatted value is not relevant or doesn't come into play when you do comparisons. So, these are all equivalent:&lt;BR /&gt;
[pre]&lt;BR /&gt;
if birthday = -3334 then output;&lt;BR /&gt;
if birthday = '15nov50'd then output;&lt;BR /&gt;
if month(birthday) = 11 and year(birthday) = 1950 and&lt;BR /&gt;
  day(birthday) = 15 then output;&lt;BR /&gt;
if birthday=mdy(11,15,1950) then output;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
So if you wanted -everybody- born in November 1950, you cannot have:&lt;BR /&gt;
[pre]&lt;BR /&gt;
if birthday = 1150 then output;&lt;BR /&gt;
but, instead would need:&lt;BR /&gt;
if month(birthday) =11 and year(birthday) = 1950 then output;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                         &lt;BR /&gt;
cynthia</description>
    <pubDate>Tue, 25 Aug 2009 17:33:06 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2009-08-25T17:33:06Z</dc:date>
    <item>
      <title>Please help me to create sas date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-help-me-to-create-sas-date/m-p/66320#M18932</link>
      <description>Hi All,&lt;BR /&gt;
&lt;BR /&gt;
I have a date in MMDDYY6. format such as 122905.&lt;BR /&gt;
I want to create a date only with month and year such as 1205. What is the correct format to use? I tried using MONYY.w but it is not working. Can any one please help me out?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Fri, 21 Aug 2009 20:47:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-help-me-to-create-sas-date/m-p/66320#M18932</guid>
      <dc:creator>rookie72</dc:creator>
      <dc:date>2009-08-21T20:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me to create sas date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-help-me-to-create-sas-date/m-p/66321#M18933</link>
      <description>Hi,&lt;BR /&gt;
  A bit more information is needed. You say that you "have a date" -- is your date column -already- in a SAS dataset? Could it be in a CSV file, or some other file (like a database file) and you want to READ it into SAS date format? Like this example of CSV:&lt;BR /&gt;
[pre]&lt;BR /&gt;
"Name","Bday","Idea"&lt;BR /&gt;
"Alan",122905,"Books"&lt;BR /&gt;
"Barb",111550,"CDs"&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                &lt;BR /&gt;
If your date value is in a SAS dataset, is it a numeric variable or a character variable? (You can figure this out by running PROC CONTENTS).  Does it have a  SAS date format assigned already (also PROC CONTENTS).&lt;BR /&gt;
     &lt;BR /&gt;
If your date variable is actually a character string, then you have to convert it from character to numeric form in order to use the MONYY format.&lt;BR /&gt;
             &lt;BR /&gt;
What do you see when you do a PROC PRINT of the data? Can you read the numbers or do they look strange? (For example 122905 stored as a SAS date value will show up unformatted in the data as: 16799 because December 29, 2005 was 16799 days after January 1, 1960). &lt;BR /&gt;
                 &lt;BR /&gt;
In order to help you, we need some idea of what you're dealing with -- raw data or data that's already in a SAS dataset or data that's coming from a relational database. Whether your date value is "raw" or is already stored as a SAS date value or is a character string that represents the date. How (what procedure) you are using to apply the MONYY format.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 21 Aug 2009 21:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-help-me-to-create-sas-date/m-p/66321#M18933</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-08-21T21:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me to create sas date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-help-me-to-create-sas-date/m-p/66322#M18934</link>
      <description>Hi Cynthia&lt;BR /&gt;
&lt;BR /&gt;
Sorry for being late. &lt;BR /&gt;
&lt;BR /&gt;
Here are the answer for your question.&lt;BR /&gt;
&lt;BR /&gt;
The date column is already in a SAS dataset. It is in MMDDYY6. format and it is a numeric variable. &lt;BR /&gt;
&lt;BR /&gt;
Here is what I want to do:&lt;BR /&gt;
&lt;BR /&gt;
1. I have a date column in a SAS dataset like:&lt;BR /&gt;
    120508 (MMDDYY6. format datatype numeric).&lt;BR /&gt;
2. I want to extract only month and year as a date format like:&lt;BR /&gt;
    1208.&lt;BR /&gt;
3. I want to subset dataset using this mmyy with if statement like&lt;BR /&gt;
   if data &amp;gt;=1205 then output sas-dataset.&lt;BR /&gt;
&lt;BR /&gt;
I am using SAS 9.1 version. I read somewhere that SAS 9.1 has bug when you use MONYY format.&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Tue, 25 Aug 2009 16:03:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-help-me-to-create-sas-date/m-p/66322#M18934</guid>
      <dc:creator>rookie72</dc:creator>
      <dc:date>2009-08-25T16:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me to create sas date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-help-me-to-create-sas-date/m-p/66323#M18935</link>
      <description>Could you do something like this:&lt;BR /&gt;
&lt;BR /&gt;
data test2;&lt;BR /&gt;
   set test;&lt;BR /&gt;
   if date ge mdy( 12, 1, 2005 ) then output;&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 25 Aug 2009 16:57:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-help-me-to-create-sas-date/m-p/66323#M18935</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-25T16:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me to create sas date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-help-me-to-create-sas-date/m-p/66324#M18936</link>
      <description>Regarding MONYY format, you would not be able to test against this "formatted" value using any value other than equal-to, since the formatted value is going to be "mmm" and "yy" where "mmm" is the character-name month value and not a number.  I suppose that until the year 2100, you could use formatted value for mmyyn4. or yymmn4. to check for &amp;gt; (greater than).  &lt;BR /&gt;
&lt;BR /&gt;
It would be best to use the MDY function as suggested so that any comparison is against the numeric (SAS internal) value, representing days since 1/1/1960.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 25 Aug 2009 17:19:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-help-me-to-create-sas-date/m-p/66324#M18936</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-08-25T17:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me to create sas date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-help-me-to-create-sas-date/m-p/66325#M18937</link>
      <description>Hi:&lt;BR /&gt;
  Remember that the formatted value is not relevant or doesn't come into play when you do comparisons. So, these are all equivalent:&lt;BR /&gt;
[pre]&lt;BR /&gt;
if birthday = -3334 then output;&lt;BR /&gt;
if birthday = '15nov50'd then output;&lt;BR /&gt;
if month(birthday) = 11 and year(birthday) = 1950 and&lt;BR /&gt;
  day(birthday) = 15 then output;&lt;BR /&gt;
if birthday=mdy(11,15,1950) then output;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
So if you wanted -everybody- born in November 1950, you cannot have:&lt;BR /&gt;
[pre]&lt;BR /&gt;
if birthday = 1150 then output;&lt;BR /&gt;
but, instead would need:&lt;BR /&gt;
if month(birthday) =11 and year(birthday) = 1950 then output;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                         &lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 25 Aug 2009 17:33:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-help-me-to-create-sas-date/m-p/66325#M18937</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-08-25T17:33:06Z</dc:date>
    </item>
  </channel>
</rss>

