<?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: Creating missing observations 5 weeks prior to a separate a date variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-missing-observations-5-weeks-prior-to-a-separate-a-date/m-p/570426#M160844</link>
    <description>&lt;P&gt;1. You code does not run.&lt;/P&gt;
&lt;P&gt;2. Please provide a sample output for your sample input.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Jul 2019 04:29:24 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2019-07-02T04:29:24Z</dc:date>
    <item>
      <title>Creating missing observations 5 weeks prior to a separate a date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-missing-observations-5-weeks-prior-to-a-separate-a-date/m-p/570294#M160791</link>
      <description>&lt;P&gt;Hello. I hope everyone is doing well on this fine Monday.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to have SAS look at a date variable,&amp;nbsp;&lt;EM&gt;Interview_Date,&amp;nbsp;&lt;/EM&gt;and use this date to mark a period of 5 weeks before the date as missing for employment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, my data looks like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data IntAge;
   infile datalines dsd truncover;
   input PID R1482600. E0011401-E0013632 Key_Sex_1997 DOB Interview_Date AgeAtInterview;
 datalines;
 1 4 5232 5232 5232 2 09/1981 07/1997 15
1 4 5232 5232 5232 2 09/1981 11/1997 17
....
....
....
1 4 5232 5232 5232 2 09/1981 01/2016 34
 2 7 6654  .   .  1 07/1982 05/1997 14 
 2 7 .  8987   8987  1 07/1982 11/1998 16 
 ;;;;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;PID is participant ID.&lt;/P&gt;&lt;P&gt;R1482600 is the participant's ethnicity&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;E0011401-E0013632 are a set of variables where E0011401 is the first week of 1994 running 52 weeks of that year all the way through&amp;nbsp;E0013632 which is week 32 of 2016. If someone is employed, the have the company code which can be seen on PID 1 with the code 5232.&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;For instance, PID 1 was hired at the same company for the first 3 weeks of 1994. Their first interview was at 07/1997. I would like to make her employment data for weeks 19-24 (4th week of 05/1997 through 07/1997) missing,&amp;nbsp;&lt;EM&gt;.N.&amp;nbsp;&lt;/EM&gt; I coded all dates to be on the 1st of each month. I did not include all of the employment variables.&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;As you can see, the data is in wide format. What I am attempting to do is to have SAS read the interview date and then mark any of the employment variables for 5 weeks prior as a special missing, .N.&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;I am not sure how to accomplish this, but my initial thoughts were to create a reference table with PID and interview date. Reference this table saying that PID has to be in this reference table and when it reads DateofInterview, call the previous five observations missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really need help firming up my logic on how to tackle this task. I have seen others create a flag for the date variable which might work here. Any help would be appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 16:04:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-missing-observations-5-weeks-prior-to-a-separate-a-date/m-p/570294#M160791</guid>
      <dc:creator>joebacon</dc:creator>
      <dc:date>2019-07-01T16:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating missing observations 5 weeks prior to a separate a date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-missing-observations-5-weeks-prior-to-a-separate-a-date/m-p/570426#M160844</link>
      <description>&lt;P&gt;1. You code does not run.&lt;/P&gt;
&lt;P&gt;2. Please provide a sample output for your sample input.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 04:29:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-missing-observations-5-weeks-prior-to-a-separate-a-date/m-p/570426#M160844</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-07-02T04:29:24Z</dc:date>
    </item>
  </channel>
</rss>

