<?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 in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Date/m-p/766230#M37453</link>
    <description>&lt;P&gt;If your plan is to perform some statistical analysis of these months, for example in PROC MEANS or PROC SUMMARY or PROC FREQ (or many other PROCs), you don't need to create a new variable, or even change the formatting in the data set. You can change the formatting in the PROC. Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=have;
    class date;
    format date yymm7.;
    var some_variable_name;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 06 Sep 2021 14:42:22 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-09-06T14:42:22Z</dc:date>
    <item>
      <title>Date</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Date/m-p/766225#M37451</link>
      <description>&lt;P&gt;I have the variable "date" whose format is in yyyymmdd, but I want to make a new variable "year_month" using only yyyymm. What code can I use?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Sep 2021 13:38:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Date/m-p/766225#M37451</guid>
      <dc:creator>Thalitacosta</dc:creator>
      <dc:date>2021-09-06T13:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Date</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Date/m-p/766227#M37452</link>
      <description>&lt;P&gt;So you have a variable that contains the number of days since 1960 and is being displayed using the YYMMDDN8. format and you want to make a new variable that is being displayed using the YYMMN6. format?&lt;/P&gt;
&lt;P&gt;You could just store the same number and display it differently.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  year_month=date;
  format year_month yymmn8.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But then some of the values that look (print) the same will actually be stored as different numbers.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead you might want to force the value in YEAR_MONTH to always be the first day of the month.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;year_month=intnx('month',date,0,'b');&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Sep 2021 14:22:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Date/m-p/766227#M37452</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-09-06T14:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: Date</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Date/m-p/766230#M37453</link>
      <description>&lt;P&gt;If your plan is to perform some statistical analysis of these months, for example in PROC MEANS or PROC SUMMARY or PROC FREQ (or many other PROCs), you don't need to create a new variable, or even change the formatting in the data set. You can change the formatting in the PROC. Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=have;
    class date;
    format date yymm7.;
    var some_variable_name;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Sep 2021 14:42:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Date/m-p/766230#M37453</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-09-06T14:42:22Z</dc:date>
    </item>
  </channel>
</rss>

