<?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: Incidence of a new event in SAS table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848902#M335632</link>
    <description>Hi&lt;BR /&gt;It's fictives data here because I can't send reals datas. To resume I have patients with ou without impact of infection at a specific visit (M00, M03 ...). At each visit a treatment is prescribed (continue or at demand) but we know exactly the traitment used at the next visit. When we have a new impact of infection we want to know which traitment the patient have followed. But when the test realised between two visit for example M03-M06 whe know the prescribed traitment but not the real followed traitment which is know at the next visit.&lt;BR /&gt;Is it more clear ?&lt;BR /&gt;Marilyn</description>
    <pubDate>Sat, 10 Dec 2022 14:58:52 GMT</pubDate>
    <dc:creator>mdeber30</dc:creator>
    <dc:date>2022-12-10T14:58:52Z</dc:date>
    <item>
      <title>Incidence of a new event in SAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848748#M335553</link>
      <description>&lt;P&gt;Hi everybody&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I start on SAS and I want to detect the impact of a new positif test in the following data and fill the impact variable in this way&amp;nbsp; :&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.JPG" style="width: 697px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78243iB5509309054D2E63/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.JPG" alt="image.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In fact we count a new impact of positive test if the test was positive a the first time of follow-up period or negative at the precedent time. I have found how sort the data by patient number and by follow-up time. I hope my&amp;nbsp; explanations are clear ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Marilyn&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 16:32:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848748#M335553</guid>
      <dc:creator>mdeber30</dc:creator>
      <dc:date>2022-12-09T16:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Incidence of a new event in SAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848750#M335555</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    by patient;
    prev_test=lag(test);
    if (first.patient and test='Positif') 
        or (not first.patient and test='Positif' and prev_test='Negatif') then incidence=1;
    else incidence=0;
    drop prev_test;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Dec 2022 16:38:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848750#M335555</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-09T16:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Incidence of a new event in SAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848830#M335585</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for your help, it's work but I have a new problem :&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image2.JPG" style="width: 464px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78271i77FD544AD774A320/image-size/large?v=v2&amp;amp;px=999" role="button" title="image2.JPG" alt="image2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to replace the missing values in Tt if the Visit isn't M00 by the Tt at the next visit. For example at visit M03-M06 I want to put 2 in the variable Tt. Is it possible ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Marilyn&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 22:40:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848830#M335585</guid>
      <dc:creator>mdeber30</dc:creator>
      <dc:date>2022-12-09T22:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: Incidence of a new event in SAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848832#M335587</link>
      <description>&lt;P&gt;Sure its possible. But I would need a better explanation and a few more examples, because I don't seem to understand what you wrote.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 22:43:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848832#M335587</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-09T22:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: Incidence of a new event in SAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848844#M335593</link>
      <description>&lt;P&gt;I send you a new example. For each patient, at M00 the traitment is missing it's normal because the patient haven't traitment before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if the visits are not M00, M03,M06, M09 ... but tests between two visits as M06-M09 or M9-M12 or M3-M6. We must have the traitment the patient have indicate taked at the next visit (because we don't know the traitment actually taken). The patient indicate the traitment taked at visits M09, M12 and M9 in this case).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image2.JPG" style="width: 619px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78274iD96F3CDC54C537CC/image-size/large?v=v2&amp;amp;px=999" role="button" title="image2.JPG" alt="image2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to have this result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image3.JPG" style="width: 610px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78275iA85578A9849EBD01/image-size/large?v=v2&amp;amp;px=999" role="button" title="image3.JPG" alt="image3.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For test at M06-M09 I put the value of M09 it's the next visit, for test at M09-M12, I put the value of M12 visit and for the test at M03-M06 I put the value of traitment of M12 visit because it's the next visit ...&lt;/P&gt;&lt;P&gt;I hope it's clear ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Marilyn&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 23:09:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848844#M335593</guid>
      <dc:creator>mdeber30</dc:creator>
      <dc:date>2022-12-09T23:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Incidence of a new event in SAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848879#M335621</link>
      <description>&lt;P&gt;Why does M09-M12 for Patient 1 go back to treatment 1?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I realize you are new here, so please help us out. We cannot really write code on data that is in screen captures. We need working SAS data step code in order to work on your data. You can type in the SAS data step code yourself or follow &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;. Do not attach files, do not use screen captures to share with us your data.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 12:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848879#M335621</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-10T12:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Incidence of a new event in SAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848902#M335632</link>
      <description>Hi&lt;BR /&gt;It's fictives data here because I can't send reals datas. To resume I have patients with ou without impact of infection at a specific visit (M00, M03 ...). At each visit a treatment is prescribed (continue or at demand) but we know exactly the traitment used at the next visit. When we have a new impact of infection we want to know which traitment the patient have followed. But when the test realised between two visit for example M03-M06 whe know the prescribed traitment but not the real followed traitment which is know at the next visit.&lt;BR /&gt;Is it more clear ?&lt;BR /&gt;Marilyn</description>
      <pubDate>Sat, 10 Dec 2022 14:58:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848902#M335632</guid>
      <dc:creator>mdeber30</dc:creator>
      <dc:date>2022-12-10T14:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Incidence of a new event in SAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848907#M335633</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/437634"&gt;@mdeber30&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;BR /&gt;It's fictives data here because I can't send reals datas. &lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Fake data is fine. You need to provide the fake data as SAS data step code, as I explained. I am not going to try to work from a screen capture of fake data.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 15:27:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848907#M335633</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-10T15:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Incidence of a new event in SAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848912#M335636</link>
      <description>Hi&lt;BR /&gt;Ok I understand now. I'll do it !&lt;BR /&gt;Marilyn</description>
      <pubDate>Sat, 10 Dec 2022 16:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848912#M335636</guid>
      <dc:creator>mdeber30</dc:creator>
      <dc:date>2022-12-10T16:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Incidence of a new event in SAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848921#M335637</link>
      <description>&lt;PRE&gt;&lt;CODE class=""&gt;data dataset;
length id_patient $ 7;
length visit $ 7;
input id_patient $ visit $ traitment time;
datalines;
Patient1 M00 . 0
Patient1 M03 1 90
Patient1 M06 1 180
Patient1 M06-M09 . 250
Patient1 M09 2 270
Patient1 M09-M12 . 290
Patient1 M09-M12 . 95
Patient1 M12 1 360
Patient1 M15 1 450
Patient2 M00 . 0 
Patient2 M03 2 90
Patient2 M03-M06 . 125
Patient2 M09 2 270
Patient2 M12 1 360
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hi here the SAS code for the dataset&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;Marilyn&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 18:21:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Incidence-of-a-new-event-in-SAS-table/m-p/848921#M335637</guid>
      <dc:creator>mdeber30</dc:creator>
      <dc:date>2022-12-10T18:21:10Z</dc:date>
    </item>
  </channel>
</rss>

