<?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: Sas year comparision in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sas-year-comparision/m-p/393510#M94776</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/163075"&gt;@Singla14&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data years;
  input year;
datalines;
2013
2014
2015
2016
2017
;
run;
proc print data=years; where year=year(today()); run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 06 Sep 2017 11:32:14 GMT</pubDate>
    <dc:creator>alexal</dc:creator>
    <dc:date>2017-09-06T11:32:14Z</dc:date>
    <item>
      <title>Sas year comparision</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-year-comparision/m-p/393472#M94759</link>
      <description>, I have input file having year ( let's say 2015 to 2017 YYYY) .&lt;BR /&gt;I am trying to fetch system year ( year(today())&lt;BR /&gt;And then compare year from input file to fetched year.&lt;BR /&gt;If matches , those rows should come in output.&lt;BR /&gt;&lt;BR /&gt;If comparison for years is not working ..Have tried reading input year in chat..Integer both..But nothing working.&lt;BR /&gt;Can some one please help..Urgent</description>
      <pubDate>Wed, 06 Sep 2017 09:26:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-year-comparision/m-p/393472#M94759</guid>
      <dc:creator>Singla14</dc:creator>
      <dc:date>2017-09-06T09:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sas year comparision</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-year-comparision/m-p/393479#M94761</link>
      <description>&lt;P&gt;show us some code &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2017 09:32:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-year-comparision/m-p/393479#M94761</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-09-06T09:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sas year comparision</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-year-comparision/m-p/393489#M94769</link>
      <description>&lt;P&gt;Show us some code&amp;nbsp;&lt;STRONG&gt;&lt;U&gt;and show us some test data data in the form of a datastep. &amp;nbsp;&lt;/U&gt;&lt;/STRONG&gt;&lt;U&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;E.g.:&lt;/P&gt;
&lt;PRE&gt;data have;
  input year;
datalines;
2013
2017
;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Sep 2017 09:43:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-year-comparision/m-p/393489#M94769</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-09-06T09:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sas year comparision</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-year-comparision/m-p/393510#M94776</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/163075"&gt;@Singla14&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data years;
  input year;
datalines;
2013
2014
2015
2016
2017
;
run;
proc print data=years; where year=year(today()); run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Sep 2017 11:32:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-year-comparision/m-p/393510#M94776</guid>
      <dc:creator>alexal</dc:creator>
      <dc:date>2017-09-06T11:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: Sas year comparision</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-year-comparision/m-p/393745#M94849</link>
      <description>&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Input file is of 150..
Year is starting at 36th..
A0214494      FLDNIW0000414600DRIN 201401010....
A0214494      FLDNIW0000104200CRIN 201401010..
A0330094      FLDQIW0000104200CRSD 201401010..


SAS code:

DATA INFLE1;
DATERUN = TODAY();
FINAL_YEAR=YEAR(DATERUN);
FORMAT FINAL_YEAR YEAR4. ;
RUN ;
PROC PRINT DATA=INFLE1;

DATA INFLE2;
INFILE DD01;
INPUT
     @36 YEARX       4.
     @1 RECORD  $CHAR150.;
FORMAT YEARX YEAR4.;
RUN;
PROC PRINT DATA=INFLE2;

DATA OUTP1;
SET INFLE1 INFLE2;
IF  YEARX = FINAL_YEAR THEN OUTPUT OUTP1 ;
RUN;
DATA FINAL1;
SET OUTP1 ;
FILE DD01O;
PUT @1 RECORD $CHAR150.;
RUN;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;YEARX = FINAL_YEAR is not working ... i have tried other formatting options too... like took input year in Char as well.. but 0 records in output..&lt;/P&gt;&lt;P&gt;I think issue is ..sas 's internal format.. 2017 would mean..1965 when i am moving it into YEAR4....&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 01:45:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-year-comparision/m-p/393745#M94849</guid>
      <dc:creator>Singla14</dc:creator>
      <dc:date>2017-09-07T01:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sas year comparision</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-year-comparision/m-p/393779#M94862</link>
      <description>&lt;P&gt;I suggest you start reading the SAS documentation, because your code has so many errors resulting from missing knowledge.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;You don't need INFLE1, you can use the functions directly when createding infle2.&lt;/LI&gt;
&lt;LI&gt;A SET statement with multiple datasets appends the datasets.&lt;/LI&gt;
&lt;LI&gt;Using a format designed for variables containing dates on a variable containing just the year-part of a date, will lead to wrong results. You don't need formats to solve the problem.&lt;/LI&gt;
&lt;/OL&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data INFLE2;
infile DD01;
input 
     @36 YearX 4.
     @1 Record  $char150.;

   if YearX = year(today());
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Sep 2017 08:06:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-year-comparision/m-p/393779#M94862</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2017-09-07T08:06:41Z</dc:date>
    </item>
  </channel>
</rss>

