<?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: Converting drug-level data (medications) to a person-level data in NHANES using PROC SUMMARY in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Converting-drug-level-data-medications-to-a-person-level-data-in/m-p/516171#M73259</link>
    <description>Sorry, you're going to long to wide: &lt;BR /&gt;&lt;A href="https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-long-to-wide-using-proc-transpose/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-long-to-wide-using-proc-transpose/&lt;/A&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 26 Nov 2018 22:30:24 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-11-26T22:30:24Z</dc:date>
    <item>
      <title>Converting drug-level data (medications) to a person-level data in NHANES using PROC SUMMARY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-drug-level-data-medications-to-a-person-level-data-in/m-p/516169#M73257</link>
      <description>&lt;P&gt;Hello all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working on a project using NHANES and trying to merge&amp;nbsp;datasets. One dataset (MEDS) lists medications patients are taking as individual observations, all with a common variable SEQN that is a unique identifier for&amp;nbsp;individual patients.&lt;/P&gt;&lt;P&gt;In order to merge the datasets I must convert this drug-level data to patient-level data&amp;nbsp;using the SEQN variable in a format that&amp;nbsp;retains&amp;nbsp; the variables RXDDRGID,&amp;nbsp;&lt;SPAN&gt;RXDDRUG, and&amp;nbsp; RXDUSE from&amp;nbsp;&lt;/SPAN&gt;the MEDS dataset without having redundant observations in my combined dataset merged by SEQN.&lt;/P&gt;&lt;P&gt;I encountered &lt;A href="http://www2.sas.com/proceedings/sugi26/p083-26.pdf" target="_self"&gt;this document&lt;/A&gt;&amp;nbsp;which appears to have the right information but&amp;nbsp;frankly it's way over my head.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far, I have read that the proc summary procedure may be the best way and this is what I have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc summary nway data=NHANES.MEDS;&lt;BR /&gt;class SEQN RXDDRGID RXDDRUG RXDUSE;&lt;BR /&gt;id SEQN RXDDRGID RXDDRUG RXDUSE;&lt;BR /&gt;output out=NHANES.FIXEDMEDS;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but this&amp;nbsp;is returning a dataset with the right variables but too many observations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am very new to SAS so any help would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 22:23:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-drug-level-data-medications-to-a-person-level-data-in/m-p/516169#M73257</guid>
      <dc:creator>amoney518</dc:creator>
      <dc:date>2018-11-26T22:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Converting drug-level data (medications) to a person-level data in NHANES using PROC SUMMARY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-drug-level-data-medications-to-a-person-level-data-in/m-p/516170#M73258</link>
      <description>Do you need to summarize data before you change the structure? If so, you likely need PROC SUMMARY. If not, you likely want PROC TRANSPOSE. &lt;A href="https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-wide-to-long-using-proc-transpose/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-wide-to-long-using-proc-transpose/&lt;/A&gt;</description>
      <pubDate>Mon, 26 Nov 2018 22:29:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-drug-level-data-medications-to-a-person-level-data-in/m-p/516170#M73258</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-26T22:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: Converting drug-level data (medications) to a person-level data in NHANES using PROC SUMMARY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-drug-level-data-medications-to-a-person-level-data-in/m-p/516171#M73259</link>
      <description>Sorry, you're going to long to wide: &lt;BR /&gt;&lt;A href="https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-long-to-wide-using-proc-transpose/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-long-to-wide-using-proc-transpose/&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Nov 2018 22:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-drug-level-data-medications-to-a-person-level-data-in/m-p/516171#M73259</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-26T22:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: Converting drug-level data (medications) to a person-level data in NHANES using PROC SUMMARY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-drug-level-data-medications-to-a-person-level-data-in/m-p/516186#M73261</link>
      <description>&lt;P&gt;Thanks for your help! This is definitely what I was looking for.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I'm still having trouble getting the right number of observations in my output datasets. I've made new code below that sorts the original dataset by the variables of interest (since each observation doesn't have a unique identifier), transposes the three variables of interest individually, then merges them&amp;nbsp;by SEQN but this doesn't seem to be working as anticipated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data=NHANES.MEDS out=NHANES.SORTEDMEDS;&lt;BR /&gt;by SEQN RXDDRGID;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc transpose data=NHANES.SORTEDMEDS out=NHANES.RXDDRGIDMEDS prefix=RXDDRGID;&lt;BR /&gt;by SEQN RXDDRGID;&lt;BR /&gt;var RXDDRGID;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc transpose data=NHANES.SORTEDMEDS out=NHANES.RXDDRUGMEDS prefix=RXDDRUG;&lt;BR /&gt;by SEQN RXDDRGID;&lt;BR /&gt;var RXDDRUG;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc transpose data=NHANES.SORTEDMEDS out=NHANES.RXDUSEMEDS prefix=RXDUSE;&lt;BR /&gt;by SEQN RXDDRGID;&lt;BR /&gt;var RXDUSE;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data NHANES.FIXEDMEDS;&lt;BR /&gt;merge NHANES.RXDDRGIDMEDS (drop=_name_) NHANES.RXDDRUGMEDS (drop =_name_) NHANES.RXDUSEMEDS (drop=_name_);&lt;BR /&gt;by SEQN ;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 00:04:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-drug-level-data-medications-to-a-person-level-data-in/m-p/516186#M73261</guid>
      <dc:creator>amoney518</dc:creator>
      <dc:date>2018-11-27T00:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Converting drug-level data (medications) to a person-level data in NHANES using PROC SUMMARY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-drug-level-data-medications-to-a-person-level-data-in/m-p/516192#M73262</link>
      <description>&lt;P&gt;Actually, I seem to have solved by the problem by limiting the BY statement to only SEQN within the PROC TRANSPOSE&amp;nbsp;procedures.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 00:22:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-drug-level-data-medications-to-a-person-level-data-in/m-p/516192#M73262</guid>
      <dc:creator>amoney518</dc:creator>
      <dc:date>2018-11-27T00:22:07Z</dc:date>
    </item>
  </channel>
</rss>

