<?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: How do I lag the exposure to outcome by a year? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-lag-the-exposure-to-outcome-by-a-year/m-p/446945#M283304</link>
    <description>&lt;P&gt;You could run your analysis on table &lt;STRONG&gt;data2&lt;/STRONG&gt; given by:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table data2 as
select 
    a.*,
    b.Exposure as lastYearExposure
from 
    data1 as a inner join 
    data1 as b on a.stateId = b.stateId and b.year = a.year-1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(untested)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Mar 2018 21:46:52 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2018-03-19T21:46:52Z</dc:date>
    <item>
      <title>How do I lag the exposure to outcome by a year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-lag-the-exposure-to-outcome-by-a-year/m-p/446930#M283303</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking to lag the exposure to outcome by a year. What I mean by this is that for a given year in my data, I want the exposure in one year to be associated with the outcome in the next, instead of the same year. This is because I want to avoid reverse causation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So if the exposure for 1999 is 26, I would want it to match with the outcome for 2000.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code without the lag:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC GENMOD data=data1;
CLASS StateID year (ref=first) event (ref=first);
MODEL&amp;nbsp;Outcome =Exposure&amp;nbsp;confounder / DIST=poisson LINK=log TYPE3 WALD offset=lnpop; 
REPEATED SUBJECT=stateid;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an offset of state population and a repeated subject on stateID. Outcome is my main outcome and exposure is my main exposure. Confounder is a confounder. I do not think that the confounder should be lagged, just the main exposure and outcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much!&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 20:44:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-lag-the-exposure-to-outcome-by-a-year/m-p/446930#M283303</guid>
      <dc:creator>Revere2323</dc:creator>
      <dc:date>2018-03-19T20:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I lag the exposure to outcome by a year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-lag-the-exposure-to-outcome-by-a-year/m-p/446945#M283304</link>
      <description>&lt;P&gt;You could run your analysis on table &lt;STRONG&gt;data2&lt;/STRONG&gt; given by:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table data2 as
select 
    a.*,
    b.Exposure as lastYearExposure
from 
    data1 as a inner join 
    data1 as b on a.stateId = b.stateId and b.year = a.year-1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(untested)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 21:46:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-lag-the-exposure-to-outcome-by-a-year/m-p/446945#M283304</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-03-19T21:46:52Z</dc:date>
    </item>
  </channel>
</rss>

