<?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: Identify OBS before and after a specific date in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Identify-OBS-before-and-after-a-specific-date/m-p/513199#M2497</link>
    <description>&lt;P&gt;If you run a PROC CONTENTS on the data set EXTRACT, what does it tell you about the DATE field?&amp;nbsp; That is the key to coding the proper comparison.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Nov 2018 03:22:11 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-11-15T03:22:11Z</dc:date>
    <item>
      <title>Identify OBS before and after a specific date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Identify-OBS-before-and-after-a-specific-date/m-p/513187#M2494</link>
      <description>&lt;P&gt;I'm got a file that includes performance info before and after a change. I want to be able to easily separate the before and after by date, so I added a new variable and am trying to mark PRE or POST change based on when the change was done. I'm using "If then" statement against date, but am&amp;nbsp;only getting PRE in all&amp;nbsp;columns. Here's what it looks like now:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Job;Procstep;Program;Stepname;Date;System;CPUTMX;Elapsed;CDate&lt;/P&gt;&lt;P&gt;ICL226ID;ICL226ID;GNC8317;STEP020;12DEC2017;SYSC;0.21;4.23;PRE&lt;/P&gt;&lt;P&gt;ICL226ID;ICL226ID;DFSRRC00;STEP010;12DEC2017;SYSC;57.61;1650.17;PRE&lt;/P&gt;&lt;P&gt;ICL226ID;ICL226ID;GNC8317;STEP020;14DEC2017;SYSC;0.23;2.35;PRE&lt;/P&gt;&lt;P&gt;ICL226ID;ICL226ID;GNC8317;STEP020;15DEC2017;SYSC;0.22;5.95;PRE&lt;/P&gt;&lt;P&gt;ICL226ID;ICL226ID;DFSRRC00;STEP010;15DEC2017;SYSC;58.11;1199.19;PRE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and what I'm looking for it do look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Job;Procstep;Program;Stepname;Date;System;CPUTMX;Elapsed;CDate&lt;/P&gt;&lt;P&gt;ICL226ID;ICL226ID;GNC8317;STEP020;12DEC2017;SYSC;0.21;4.23;PRE&lt;/P&gt;&lt;P&gt;ICL226ID;ICL226ID;DFSRRC00;STEP010;12DEC2017;SYSC;57.61;1650.17;PRE&lt;/P&gt;&lt;P&gt;ICL226ID;ICL226ID;GNC8317;STEP020;14DEC2017;SYSC;0.23;2.35;PRE&lt;/P&gt;&lt;P&gt;ICL226ID;ICL226ID;GNC8317;STEP020;15DEC2017;SYSC;0.22;5.95;POST&lt;/P&gt;&lt;P&gt;ICL226ID;ICL226ID;DFSRRC00;STEP010;15DEC2017;SYSC;58.11;1199.19;POST&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code I've tried is below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data _null_ ;&lt;/P&gt;&lt;P&gt;FILE DMAN1 DELIMITER =';' DROPOVER ;&lt;/P&gt;&lt;P&gt;if _n_=1 then put&lt;/P&gt;&lt;P&gt;'Job;Procstep;Program;Stepname;Date;System;CPUTMX;Elapsed;CD);&lt;/P&gt;&lt;P&gt;set extract ;&lt;/P&gt;&lt;P&gt;IF DATE &amp;lt;='14DEC2017' THEN CD='PRE';&lt;/P&gt;&lt;P&gt;else CD='POST';&lt;/P&gt;&lt;P&gt;put (job procstep program stepname newdate system cputmx elapsed CD)&lt;/P&gt;&lt;P&gt;(+0);&lt;/P&gt;&lt;P&gt;run ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate the help. &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 02:31:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Identify-OBS-before-and-after-a-specific-date/m-p/513187#M2494</guid>
      <dc:creator>dman1414</dc:creator>
      <dc:date>2018-11-15T02:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: Identify OBS before and after a specific date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Identify-OBS-before-and-after-a-specific-date/m-p/513199#M2497</link>
      <description>&lt;P&gt;If you run a PROC CONTENTS on the data set EXTRACT, what does it tell you about the DATE field?&amp;nbsp; That is the key to coding the proper comparison.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 03:22:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Identify-OBS-before-and-after-a-specific-date/m-p/513199#M2497</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-15T03:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Identify OBS before and after a specific date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Identify-OBS-before-and-after-a-specific-date/m-p/513332#M2512</link>
      <description>&lt;P&gt;Here is what I see with proc contents:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ALPHABETIC LIST OF VARIABLES AND ATTRIBUTES&lt;/P&gt;&lt;P&gt;# VARIABLE TYPE LEN FORMAT LABEL&lt;/P&gt;&lt;P&gt;8 NEWDATE NUM&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATE9.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my output file it displays like this: 12DEC2017. I also tried format newdate DDMMYY10. Getting this result&amp;nbsp;12/12/2017 in my output file and then I tried coding the if statement like this: &amp;nbsp;&lt;/P&gt;&lt;P&gt;if date LT EQ '14/12/2017' then Cdate='PRE';&lt;/P&gt;&lt;P&gt;else Cdate='POST';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 14:39:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Identify-OBS-before-and-after-a-specific-date/m-p/513332#M2512</guid>
      <dc:creator>dman1414</dc:creator>
      <dc:date>2018-11-15T14:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: Identify OBS before and after a specific date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Identify-OBS-before-and-after-a-specific-date/m-p/513360#M2514</link>
      <description>&lt;P&gt;The format that you apply doesn't impact the statements needed.&amp;nbsp; I just had to know what was in the DATE variable.&amp;nbsp; Here's the proper way to refer to a specific date:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;IF DATE &amp;lt;='14DEC2017'd THEN CD='PRE';&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The "d" immediately after the closing quote tells SAS that this is a date.&amp;nbsp; You would use the same statement whenever the date variable is a legitimate numeric date, regardless of the format.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 15:21:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Identify-OBS-before-and-after-a-specific-date/m-p/513360#M2514</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-15T15:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: Identify OBS before and after a specific date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Identify-OBS-before-and-after-a-specific-date/m-p/513524#M2548</link>
      <description>&lt;P&gt;I was able to make the recommended change, but now I get a note that says: variable Date is uninitialized and it gives the DMAN1 file name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the out&lt;/P&gt;&lt;P&gt;&amp;nbsp;DATA _NULL_ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;FILE DMAN1 DELIMITER =';' DROPOVER ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;IF _N_=1 THEN PUT&lt;/P&gt;&lt;P&gt;&amp;nbsp;'JOB;PROCSTEP;PROGRAM;STEPNAME;DATE;SYSTEM;CPUTMX;ELAPSED;CD';&lt;/P&gt;&lt;P&gt;&amp;nbsp;SET EXTRACT ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;IF DATE &amp;lt;= '14DEC2017'D THEN CD='PRE';&lt;/P&gt;&lt;P&gt;&amp;nbsp;ELSE CD='POST';&lt;/P&gt;&lt;P&gt;&amp;nbsp;PUT (JOB PROCSTEP PROGRAM STEPNAME NEWDATE SYSTEM CPUTMX ELAPSED CD)&lt;/P&gt;&lt;P&gt;&amp;nbsp;(+0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;RUN ;&lt;/P&gt;&lt;P&gt;NOTE: VARIABLE DATE IS UNINITIALIZED.&lt;/P&gt;&lt;P&gt;NOTE: THE FILE DMAN1 IS:&lt;/P&gt;&lt;P&gt;DSNAME=SOTS175.AF54125.ICLTEST9.CSV,&lt;/P&gt;&lt;P&gt;UNIT=3390,VOLUME=TSTP18,DISP=NEW,BLKSIZE=27998,&lt;/P&gt;&lt;P&gt;LRECL=27000,RECFM=VB,CREATION=2018/11/15&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 19:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Identify-OBS-before-and-after-a-specific-date/m-p/513524#M2548</guid>
      <dc:creator>dman1414</dc:creator>
      <dc:date>2018-11-15T19:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: Identify OBS before and after a specific date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Identify-OBS-before-and-after-a-specific-date/m-p/513602#M2557</link>
      <description>&lt;P&gt;I finally figured out why I was getting the variable date was uninitialized. I used format newdate earlier in the program. Thanks for getting me 99.9% there. Code is doing what I'm looking for.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 20:58:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Identify-OBS-before-and-after-a-specific-date/m-p/513602#M2557</guid>
      <dc:creator>dman1414</dc:creator>
      <dc:date>2018-11-15T20:58:17Z</dc:date>
    </item>
  </channel>
</rss>

