<?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: Matching up 2 groups of variables (e.g. procedures labeled PR1-15) and day of procedure  (PRDAY1 in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Matching-up-2-groups-of-variables-e-g-procedures-labeled-PR1-15/m-p/514169#M2669</link>
    <description>&lt;P&gt;OK, here's a step in that direction:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;array PR {15} PR1-PR15;&lt;/P&gt;
&lt;P&gt;array PRDAY {15} PRday1-PRday15;&lt;/P&gt;
&lt;P&gt;do k=1 to 15;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;if PR{k} = '6701' then do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if surgeryvar1 = . then Surgeryvar1=PRday{k};&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else Surveryvar2=PRday{k};&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Sun, 18 Nov 2018 00:05:34 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-11-18T00:05:34Z</dc:date>
    <item>
      <title>Matching up 2 groups of variables (e.g. procedures labeled PR1-15) and day of procedure  (PRDAY1-15)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Matching-up-2-groups-of-variables-e-g-procedures-labeled-PR1-15/m-p/514143#M2662</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a group of variables that describe what procedure a patient got (up to 15 procedures)&amp;nbsp;that are ICD-9 codes in strings (e.g. "6701") that are PR1, PR2.....PR15.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another group of variables are the day on which those procedures happen (e.g. 1, 2, 5, 10...) that are PRDAY1, PRDAY2....PRDAY15.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I match up what day a SPECIFIC procedure happened? e.g. I need a variable that tells me that patient got procedure 6701 (Surgery) on day 6.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are how the procedure variables have been labeled thus far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Inpatients;&lt;/P&gt;&lt;P&gt;array PR {15} PR1-15;&lt;/P&gt;&lt;P&gt;do k=1 to 15;&lt;/P&gt;&lt;P&gt;if PR{k] = '6701] then Surgery =1&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using SAS 9&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Nov 2018 18:29:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Matching-up-2-groups-of-variables-e-g-procedures-labeled-PR1-15/m-p/514143#M2662</guid>
      <dc:creator>str8gone24</dc:creator>
      <dc:date>2018-11-17T18:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Matching up 2 groups of variables (e.g. procedures labeled PR1-15) and day of procedure  (PRDAY1</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Matching-up-2-groups-of-variables-e-g-procedures-labeled-PR1-15/m-p/514147#M2664</link>
      <description>&lt;P&gt;What I've tried, not sure if this makes sense:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Dataset;&lt;/P&gt;&lt;P&gt;set Dataset;&lt;/P&gt;&lt;P&gt;array PR {15} PR1-15;&lt;/P&gt;&lt;P&gt;do k=1 to 15;&lt;/P&gt;&lt;P&gt;array PRDAY {15} PRday1-15;&lt;/P&gt;&lt;P&gt;do k=1 to 15; if PR{k} = '6701' then Surgeryvar=PRday{k};&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Nov 2018 18:51:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Matching-up-2-groups-of-variables-e-g-procedures-labeled-PR1-15/m-p/514147#M2664</guid>
      <dc:creator>str8gone24</dc:creator>
      <dc:date>2018-11-17T18:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Matching up 2 groups of variables (e.g. procedures labeled PR1-15) and day of procedure  (PRDAY1</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Matching-up-2-groups-of-variables-e-g-procedures-labeled-PR1-15/m-p/514150#M2665</link>
      <description>Can you please provide a small sample of how your data looks like and what you want as output?</description>
      <pubDate>Sat, 17 Nov 2018 19:54:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Matching-up-2-groups-of-variables-e-g-procedures-labeled-PR1-15/m-p/514150#M2665</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-17T19:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Matching up 2 groups of variables (e.g. procedures labeled PR1-15) and day of procedure  (PRDAY1</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Matching-up-2-groups-of-variables-e-g-procedures-labeled-PR1-15/m-p/514151#M2666</link>
      <description>&lt;P&gt;You're on the right track.&amp;nbsp; One thing that stands out as needing to be changed:&amp;nbsp; how you specify a list of variables.&amp;nbsp; The right way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;array PR {15} PR1-PR15;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;array PRDAY {15} PRday1-PRday15;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It's possible that this is the only change you need to make.&amp;nbsp; Try it and see what you get.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also, consider what you would like to do if the patient had two surgeries, and you would need two variables to hold the dates.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Nov 2018 19:59:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Matching-up-2-groups-of-variables-e-g-procedures-labeled-PR1-15/m-p/514151#M2666</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-17T19:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Matching up 2 groups of variables (e.g. procedures labeled PR1-15) and day of procedure  (PRDAY1</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Matching-up-2-groups-of-variables-e-g-procedures-labeled-PR1-15/m-p/514155#M2667</link>
      <description>Oh gosh you're right about needing two variables if two surgeries. I'm trying to see if two procedures ever happened on the same day and I thought I needed one variable for each procedure day and then i got just see when they matched, but now....</description>
      <pubDate>Sat, 17 Nov 2018 21:00:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Matching-up-2-groups-of-variables-e-g-procedures-labeled-PR1-15/m-p/514155#M2667</guid>
      <dc:creator>str8gone24</dc:creator>
      <dc:date>2018-11-17T21:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Matching up 2 groups of variables (e.g. procedures labeled PR1-15) and day of procedure  (PRDAY1</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Matching-up-2-groups-of-variables-e-g-procedures-labeled-PR1-15/m-p/514169#M2669</link>
      <description>&lt;P&gt;OK, here's a step in that direction:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;array PR {15} PR1-PR15;&lt;/P&gt;
&lt;P&gt;array PRDAY {15} PRday1-PRday15;&lt;/P&gt;
&lt;P&gt;do k=1 to 15;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;if PR{k} = '6701' then do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if surgeryvar1 = . then Surgeryvar1=PRday{k};&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else Surveryvar2=PRday{k};&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Nov 2018 00:05:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Matching-up-2-groups-of-variables-e-g-procedures-labeled-PR1-15/m-p/514169#M2669</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-18T00:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: Matching up 2 groups of variables (e.g. procedures labeled PR1-15) and day of procedure  (PRDAY1</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Matching-up-2-groups-of-variables-e-g-procedures-labeled-PR1-15/m-p/514187#M2673</link>
      <description>You would be better off transposing your data then you don't have this issue. If your data is organized as&lt;BR /&gt;&lt;BR /&gt;ID Procedure Procedure_Date Procedure_Count &lt;BR /&gt;1 6701 01Jan2018 1&lt;BR /&gt;2 4533 03Jan2018 1&lt;BR /&gt;1 6701 01Jan2017 1&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Then you could do:&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;where procedure in (6701);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;In general, this structure is more useful for answering a variety of questions. &lt;BR /&gt;&lt;BR /&gt;I worked with healthcare data for over 5 years and have found this data structure to be optimal. Here's a tutorial on transforming your data:&lt;BR /&gt;&lt;A href="https://stats.idre.ucla.edu/sas/modules/reshaping-data-wide-to-long-using-a-data-step/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/modules/reshaping-data-wide-to-long-using-a-data-step/&lt;/A&gt;</description>
      <pubDate>Sun, 18 Nov 2018 05:12:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Matching-up-2-groups-of-variables-e-g-procedures-labeled-PR1-15/m-p/514187#M2673</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-18T05:12:11Z</dc:date>
    </item>
  </channel>
</rss>

