<?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: Get the Current year,Current Month,Prev Month,Prev Year in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Get-the-Current-year-Current-Month-Prev-Month-Prev-Year/m-p/605634#M175788</link>
    <description>&lt;P&gt;Just to understand, all you want is a table with the current year, month, the previous year and the previous month?&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2019 07:23:47 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-11-20T07:23:47Z</dc:date>
    <item>
      <title>Get the Current year,Current Month,Prev Month,Prev Year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-Current-year-Current-Month-Prev-Month-Prev-Year/m-p/605633#M175787</link>
      <description>&lt;P&gt;hi,&lt;BR /&gt;iam struggling to create output to get the current year,current month,previous_year,previous_month.&lt;BR /&gt;and iam using below code and iam not getting waht iam expecting please.kindly help&lt;BR /&gt;expected output should be&lt;BR /&gt;all the columns should be in numeric format and not character format&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   proc sql;
      create view work.WXVDZU as
         select
            
            
           (year(today())) as Current_Year length = 8
               format = z2.
               informat = z2.,
            (month(today())) as Current_Month length = 8
               format = z2.
               informat = z2.,
            (%sysfunc(year(%sysfunc(intnx(month, %sysfunc(today()), -1))))) as Previous_Year length = 8
               format = z2.
               informat = z2.,
            (%sysfunc(month(%sysfunc(intnx(month, %sysfunc(today()), -1))))) as Previour_Month length = 8
               format = z2.
               informat = z2.
      from &amp;amp;etls_lastTable
      ;
   quit;;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Nov 2019 07:20:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-Current-year-Current-Month-Prev-Month-Prev-Year/m-p/605633#M175787</guid>
      <dc:creator>JJP1</dc:creator>
      <dc:date>2019-11-20T07:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: Get the Current year,Current Month,Prev Month,Prev Year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-Current-year-Current-Month-Prev-Month-Prev-Year/m-p/605634#M175788</link>
      <description>&lt;P&gt;Just to understand, all you want is a table with the current year, month, the previous year and the previous month?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 07:23:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-Current-year-Current-Month-Prev-Month-Prev-Year/m-p/605634#M175788</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-20T07:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: Get the Current year,Current Month,Prev Month,Prev Year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-Current-year-Current-Month-Prev-Month-Prev-Year/m-p/605635#M175789</link>
      <description>&lt;P&gt;The view you are trying to create does not need any variable from "&amp;amp;etls_lastTable", right? Why do want to create a view at all?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 07:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-Current-year-Current-Month-Prev-Month-Prev-Year/m-p/605635#M175789</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-11-20T07:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Get the Current year,Current Month,Prev Month,Prev Year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-Current-year-Current-Month-Prev-Month-Prev-Year/m-p/605636#M175790</link>
      <description>&lt;P&gt;yes&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp; .all i need&amp;nbsp; is&amp;nbsp;&lt;SPAN&gt;with the current year, current month, the previous year and the previous month values with numeric columns.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;also i need informat and format values also what to mention&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;as iam using this in SAS DI please&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 07:40:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-Current-year-Current-Month-Prev-Month-Prev-Year/m-p/605636#M175790</guid>
      <dc:creator>JJP1</dc:creator>
      <dc:date>2019-11-20T07:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Get the Current year,Current Month,Prev Month,Prev Year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-Current-year-Current-Month-Prev-Month-Prev-Year/m-p/605637#M175791</link>
      <description>&lt;P&gt;You only need %SYSFUNC if you are doing calculations on macro variables, and I see no macro variables at all. You can start by removing all uses of %SYSFUNC.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 07:41:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-Current-year-Current-Month-Prev-Month-Prev-Year/m-p/605637#M175791</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-11-20T07:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Get the Current year,Current Month,Prev Month,Prev Year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-Current-year-Current-Month-Prev-Month-Prev-Year/m-p/605641#M175794</link>
      <description>&lt;P&gt;To simply create a dataset, use SAS' in-built Swiss Army Knife, aka The Data Step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data wxvdzu;
length
  current_year
  current_month
  previous_year
  previous_month
    3
;
format
  current_year
  previous_year
    z4.
  current_month
  previous_month
    z2.
;
current_year = year(today());
current_month = month(today());
previous_year = year(intnx('month',today(),-1));
previous_month = month(intnx('month',today(),-1));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Nov 2019 08:20:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-Current-year-Current-Month-Prev-Month-Prev-Year/m-p/605641#M175794</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-20T08:20:36Z</dc:date>
    </item>
  </channel>
</rss>

