<?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 Need to help to create new variables from date_variables &amp;quot;01Jan2005&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-to-help-to-create-new-variables-from-date-variables-quot/m-p/261563#M50931</link>
    <description>&lt;P&gt;I would like to know how I can create three variables date, month and year from date_variable (example:&amp;nbsp;01Jan2005). I have a column of date_variable,but I want to extract it into date_variable, month_variable, and year_variable. Please suggest me. Thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Apr 2016 01:39:28 GMT</pubDate>
    <dc:creator>Cathy</dc:creator>
    <dc:date>2016-04-06T01:39:28Z</dc:date>
    <item>
      <title>Need to help to create new variables from date_variables "01Jan2005"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-help-to-create-new-variables-from-date-variables-quot/m-p/261563#M50931</link>
      <description>&lt;P&gt;I would like to know how I can create three variables date, month and year from date_variable (example:&amp;nbsp;01Jan2005). I have a column of date_variable,but I want to extract it into date_variable, month_variable, and year_variable. Please suggest me. Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 01:39:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-help-to-create-new-variables-from-date-variables-quot/m-p/261563#M50931</guid>
      <dc:creator>Cathy</dc:creator>
      <dc:date>2016-04-06T01:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Need to help to create new variables from date_variables "01Jan2005"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-help-to-create-new-variables-from-date-variables-quot/m-p/261566#M50932</link>
      <description>Please I need the help!Anyone knows?</description>
      <pubDate>Wed, 06 Apr 2016 01:50:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-help-to-create-new-variables-from-date-variables-quot/m-p/261566#M50932</guid>
      <dc:creator>Cathy</dc:creator>
      <dc:date>2016-04-06T01:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Need to help to create new variables from date_variables "01Jan2005"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-help-to-create-new-variables-from-date-variables-quot/m-p/261569#M50934</link>
      <description>&lt;P&gt;When you say your date variable might be 01JAN2005 ... it makes a big difference whether or not this is stored as a character string. &amp;nbsp;It also makes a big difference as to what you want the output to be. &amp;nbsp;So, assuming your original variable is a character string, and assuming you want three numeric variables as the result, this would work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;day = input(date_var, 2.);&lt;/P&gt;
&lt;P&gt;month = month(input(date_var, date9.));&lt;/P&gt;
&lt;P&gt;year = year(input(date_var, date9.));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If what you want is something different, you'll have to provide more details.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 02:07:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-help-to-create-new-variables-from-date-variables-quot/m-p/261569#M50934</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-04-06T02:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Need to help to create new variables from date_variables "01Jan2005"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-help-to-create-new-variables-from-date-variables-quot/m-p/261570#M50935</link>
      <description>&lt;P&gt;Ok. see example below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
date='01jan2005'd;
day=day(date);
month=month(date);
year=year(date);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, my question for you is: what is the big picture problem you are facing?There maybe better solutions from the root or beginning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 02:10:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-help-to-create-new-variables-from-date-variables-quot/m-p/261570#M50935</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-04-06T02:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need to help to create new variables from date_variables "01Jan2005"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-help-to-create-new-variables-from-date-variables-quot/m-p/261571#M50936</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
date_str = "01Jan2005";

date_var = "01Jan2005"d;
/* Or */
date_var = input("01Jan2005", date9.);

format date_var yymmdd10.;
day_var = day(date_var);
month_var = month(date_var);
year_var = year(date_var);
run;

proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Apr 2016 02:10:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-help-to-create-new-variables-from-date-variables-quot/m-p/261571#M50936</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-04-06T02:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Need to help to create new variables from date_variables "01Jan2005"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-help-to-create-new-variables-from-date-variables-quot/m-p/261572#M50937</link>
      <description>Thanks a lot, it is the numeric variable. And I have a column of date_variable;&lt;BR /&gt;cards;&lt;BR /&gt;gender date_variabe&lt;BR /&gt;F 01Jan2005&lt;BR /&gt;M 04Sep2007&lt;BR /&gt;M 09Oct2008&lt;BR /&gt;;&lt;BR /&gt;I want to create new 3 variables from date_variables, and I did as you suggested&lt;BR /&gt;&lt;BR /&gt;day = input(date_var, 2.);&lt;BR /&gt;month = month(input(date_var, date9.));&lt;BR /&gt;year = year(input(date_var, date9.));&lt;BR /&gt;&lt;BR /&gt;But all the columns are blank. Thanks a lot again. I will try with the last comment that you mentioned.</description>
      <pubDate>Wed, 06 Apr 2016 02:20:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-help-to-create-new-variables-from-date-variables-quot/m-p/261572#M50937</guid>
      <dc:creator>Cathy</dc:creator>
      <dc:date>2016-04-06T02:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need to help to create new variables from date_variables "01Jan2005"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-help-to-create-new-variables-from-date-variables-quot/m-p/261577#M50939</link>
      <description>Thanks a lot Haikuo, Astounding, and PGStats. I got it, finally. It took me 3 or 4 days to understand. I am so happy now. Thanks again.</description>
      <pubDate>Wed, 06 Apr 2016 02:35:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-help-to-create-new-variables-from-date-variables-quot/m-p/261577#M50939</guid>
      <dc:creator>Cathy</dc:creator>
      <dc:date>2016-04-06T02:35:44Z</dc:date>
    </item>
  </channel>
</rss>

