<?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 new variable for second patient surgery only in SAS Software for Learning Community</title>
    <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Creating-new-variable-for-second-patient-surgery-only/m-p/847852#M848</link>
    <description>Obs PT_ID HOSMKG EVENT_DATE CONDX OUTCOME AGE SEX RACE&lt;BR /&gt;1 1 0 15951 MI/BYPASS 9 52.341 F 3&lt;BR /&gt;2 2 1 15830 MI/PERC 2 28.095 F 3&lt;BR /&gt;3 3 0 15767 MI/BYPASS 2 40.785 F 3&lt;BR /&gt;4 3 0 15797 MI/BYPASS 2 . F 3&lt;BR /&gt;5 4 1 15797 MI/BYPASS 2 47.063 F 3&lt;BR /&gt;</description>
    <pubDate>Mon, 05 Dec 2022 17:45:49 GMT</pubDate>
    <dc:creator>rjacksonbeal</dc:creator>
    <dc:date>2022-12-05T17:45:49Z</dc:date>
    <item>
      <title>Creating new variable for second patient surgery only</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Creating-new-variable-for-second-patient-surgery-only/m-p/847845#M846</link>
      <description>&lt;P&gt;I need to create a two-way table with the row variable as first surgery and column variable as second surgery per patient per day. I created a counter variable then created the variables CONDX1 and CONDX2 for first and second surgeries, but when I create the table, the values for CONDX2 are all in a separate row. How can I make it so CONDX2 indicates which surgeries were done the same day and for the same patient as those for CONDX1?&lt;/P&gt;&lt;P&gt;Here is my code:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SORT DATA=PROJECT.COMPLETE;&lt;BR /&gt;BY PT_ID EVENT_DATE;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA VISITSCOUNTER;&lt;BR /&gt;SET PROJECT.COMPLETE;&lt;BR /&gt;BY PT_ID EVENT_DATE;&lt;BR /&gt;IF FIRST.EVENT_DATE=1 THEN VISITS=0;&lt;BR /&gt;VISITS+1;&lt;BR /&gt;IF LAST.EVENT_DATE=1 THEN OUTPUT;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA Question9;&lt;BR /&gt;SET VISITSCOUNTER;&lt;BR /&gt;BY PT_ID EVENT_DATE;&lt;BR /&gt;IF VISITS=1 THEN CONDX1=CONDX;&lt;BR /&gt;IF VISITS=2 THEN CONDX2=CONDX;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 17:23:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Creating-new-variable-for-second-patient-surgery-only/m-p/847845#M846</guid>
      <dc:creator>rjacksonbeal</dc:creator>
      <dc:date>2022-12-05T17:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variable for second patient surgery only</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Creating-new-variable-for-second-patient-surgery-only/m-p/847848#M847</link>
      <description>&lt;P&gt;We need to see (a portion of) data set PROJECT.COMPLETE. Please provide the data was working SAS data step code, which you can type in yourself or you can 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 provide data as screen captures.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 17:39:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Creating-new-variable-for-second-patient-surgery-only/m-p/847848#M847</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-05T17:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variable for second patient surgery only</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Creating-new-variable-for-second-patient-surgery-only/m-p/847852#M848</link>
      <description>Obs PT_ID HOSMKG EVENT_DATE CONDX OUTCOME AGE SEX RACE&lt;BR /&gt;1 1 0 15951 MI/BYPASS 9 52.341 F 3&lt;BR /&gt;2 2 1 15830 MI/PERC 2 28.095 F 3&lt;BR /&gt;3 3 0 15767 MI/BYPASS 2 40.785 F 3&lt;BR /&gt;4 3 0 15797 MI/BYPASS 2 . F 3&lt;BR /&gt;5 4 1 15797 MI/BYPASS 2 47.063 F 3&lt;BR /&gt;</description>
      <pubDate>Mon, 05 Dec 2022 17:45:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Creating-new-variable-for-second-patient-surgery-only/m-p/847852#M848</guid>
      <dc:creator>rjacksonbeal</dc:creator>
      <dc:date>2022-12-05T17:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variable for second patient surgery only</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Creating-new-variable-for-second-patient-surgery-only/m-p/847874#M849</link>
      <description>&lt;P&gt;You say&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;but when I create the table, the values for CONDX2 are all in a separate row.&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;and I just don't see that when I run this code, I see CONDX2 never gets assigned a value.&lt;/SPAN&gt;&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="PaigeMiller_0-1670266548365.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78045iCF0DB2D44B09BF9D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PaigeMiller_0-1670266548365.png" alt="PaigeMiller_0-1670266548365.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So either the data you provided is not the same data that is causing the problem, or the code you provided is not the same code that is causing the problem (or both).&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 18:57:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Creating-new-variable-for-second-patient-surgery-only/m-p/847874#M849</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-05T18:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variable for second patient surgery only</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Creating-new-variable-for-second-patient-surgery-only/m-p/847886#M850</link>
      <description>Did I not create CONDX2 with "IF VISITS=2 THEN CONDXX2=CONDX"?</description>
      <pubDate>Mon, 05 Dec 2022 19:25:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Creating-new-variable-for-second-patient-surgery-only/m-p/847886#M850</guid>
      <dc:creator>rjacksonbeal</dc:creator>
      <dc:date>2022-12-05T19:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new variable for second patient surgery only</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/Creating-new-variable-for-second-patient-surgery-only/m-p/847888#M851</link>
      <description>&lt;P&gt;I am running the exact unchanged unedited code you posted. Maybe you posted the wrong code. Maybe the data you provided me doesn't match the data you are using.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 19:30:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/Creating-new-variable-for-second-patient-surgery-only/m-p/847888#M851</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-05T19:30:06Z</dc:date>
    </item>
  </channel>
</rss>

