<?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: Randomly assigning an Index Date to a patient in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-an-Index-Date-to-a-patient/m-p/137842#M27861</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/statug/65328/HTML/default/viewer.htm#statug_surveyselect_syntax.htm" title="https://support.sas.com/documentation/cdl/en/statug/65328/HTML/default/viewer.htm#statug_surveyselect_syntax.htm"&gt;SAS/STAT(R) 12.1 User's Guide&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Jan 2015 13:01:43 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2015-01-27T13:01:43Z</dc:date>
    <item>
      <title>Randomly assigning an Index Date to a patient</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-an-Index-Date-to-a-patient/m-p/137838#M27857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wondered if anyone could me in coming up with some SAS code help to randomly assign an index date to a patients diagnosis, (lets say diabetes), within a 6 month calender block?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Normally the index date would be taken as first occurrence of diagnosis, in this instance though the index date is is assigned by randomly selecting one of the patients physician visits within the 6 month calender block that the first diagnosis occurred.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example patient X is diagnosed 02Jan2000 with Diabetes.&amp;nbsp; He has 100 Physician visits and dates in the healthcare database&amp;nbsp; , 90 of these dates/visits occur in the same&amp;nbsp; 6 month block of time&amp;nbsp; 01jan2000 - 30june2000 as the first diagnosis of diabetes.&amp;nbsp; 1 of these 90&amp;nbsp; visit dates has to be randomly chosen and assigned to the patient as the index date.&amp;nbsp; The other 10 visit dates can't be used as they fall outside of the &lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;cohort accrual 6 month block (either before or after &lt;SPAN style="font-size: 13.3333330154419px;"&gt;01jan2000 - 30june2000)&lt;/SPAN&gt;. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;Does anyone have some code that would help me find and assign index dates this way please?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;The over all cohort of patients&amp;nbsp; spans 2004-2013 so there would be 20 blocks of&amp;nbsp; 6 months to work through. Index are only assigned/matched within each block so if a diagnosis occurred in block 20 (1JUL2013-31DEC2013) then only visits for that patient also falling within the same time block are used to randomly find and assign an index date for that patient.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far I have created a dataset with&amp;nbsp; first diagnosis and have created a variable Index_Range that I have populated as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PatID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dx Date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Index_Range&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20Jan2005&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1JAN2005 - 30JUN2005&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&lt;SPAN style="font-size: 13.3333330154419px;"&gt;JUN2006&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 13.3333330154419px;"&gt;1JAN2006 - 30JUN2006&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 02SEP2012&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 13.3333330154419px;"&gt;1JUL2012 - 31DEC2012&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I next&amp;nbsp; search and pull out all physician records for patients in dataset created above and assign a similar Index_Range type variable using the physician visit date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I presume I then merge all visits in Diagnosis dataset and Physician visit Dataset matching on&amp;nbsp; PatiD and Index_Range variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I don't know is how to code after, when i have merged my datasets and have all the visits matched via index range to the patients diagnosis&amp;nbsp; what is the code I use&amp;nbsp; to randomly select only one visit per patient and assign that visit as the Index date.&amp;nbsp; Any thoughts on helping me write the code to 'randomly select' would be great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 11:53:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-an-Index-Date-to-a-patient/m-p/137838#M27857</guid>
      <dc:creator>lisahoward</dc:creator>
      <dc:date>2015-01-26T11:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly assigning an Index Date to a patient</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-an-Index-Date-to-a-patient/m-p/137839#M27858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Selecting the random sample of the targeted range of visits is the easiest step in your process and can be done with PROC SURVEYSELECT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; visit;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; PatID&amp;nbsp; (DxDate inx1-inx2 visitDate) (:&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;) visitnum;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; dxdate inx1-inx2 visitdate &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;date9.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;cards&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffc0;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20Jan2005&amp;nbsp;&amp;nbsp;&amp;nbsp; 1JAN2005&amp;nbsp; 30JUN2005 05Jan2005 4 &lt;BR /&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20Jan2005&amp;nbsp;&amp;nbsp;&amp;nbsp; 1JAN2005&amp;nbsp; 30JUN2005 25Jan2005 5&lt;BR /&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20Jan2005&amp;nbsp;&amp;nbsp;&amp;nbsp; 1JAN2005&amp;nbsp; 30JUN2005 03APR2005 6&lt;BR /&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20Jan2005&amp;nbsp;&amp;nbsp;&amp;nbsp; 1JAN2005&amp;nbsp; 30JUN2005 28MAY2005 7&lt;BR /&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20Jan2005&amp;nbsp;&amp;nbsp;&amp;nbsp; 1JAN2005&amp;nbsp; 30JUN2005 01JUN2005 8&lt;BR /&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20Jan2005&amp;nbsp;&amp;nbsp;&amp;nbsp; 1JAN2005&amp;nbsp; 30JUN2005 05Jan2005 4 &lt;BR /&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20Jan2005&amp;nbsp;&amp;nbsp;&amp;nbsp; 1JAN2005&amp;nbsp; 30JUN2005 25Jan2005 5&lt;BR /&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20Jan2005&amp;nbsp;&amp;nbsp;&amp;nbsp; 1JAN2005&amp;nbsp; 30JUN2005 03APR2005 6&lt;BR /&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20Jan2005&amp;nbsp;&amp;nbsp;&amp;nbsp; 1JAN2005&amp;nbsp; 30JUN2005 28MAY2005 7&lt;BR /&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20Jan2005&amp;nbsp;&amp;nbsp;&amp;nbsp; 1JAN2005&amp;nbsp; 30JUN2005 01JUN2005 8&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;;;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;surveyselect&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;SEED&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;557754207&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;N&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=dxvisit;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;strata&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; patid;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;print&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;IMG alt="1-26-2015 6-13-45 AM.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/8845_1-26-2015 6-13-45 AM.png" width="450" /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 12:15:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-an-Index-Date-to-a-patient/m-p/137839#M27858</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-01-26T12:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly assigning an Index Date to a patient</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-an-Index-Date-to-a-patient/m-p/137840#M27859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much for your quick response.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 13:12:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-an-Index-Date-to-a-patient/m-p/137840#M27859</guid>
      <dc:creator>lisahoward</dc:creator>
      <dc:date>2015-01-26T13:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly assigning an Index Date to a patient</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-an-Index-Date-to-a-patient/m-p/137841#M27860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What does the seedvalue (&lt;SPAN style="font-size: 14.6666679382324px; font-family: 'Courier New'; color: #0000ff; background-color: #ffffff;"&gt;SEED&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.6666679382324px; font-family: 'Courier New'; color: #000000; background-color: #ffffff;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="font-size: 14.6666679382324px; font-family: 'Courier New'; color: #008080; background-color: #ffffff;"&gt;557754207&lt;/STRONG&gt;) indicates?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 07:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-an-Index-Date-to-a-patient/m-p/137841#M27860</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-01-27T07:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly assigning an Index Date to a patient</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-an-Index-Date-to-a-patient/m-p/137842#M27861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/statug/65328/HTML/default/viewer.htm#statug_surveyselect_syntax.htm" title="https://support.sas.com/documentation/cdl/en/statug/65328/HTML/default/viewer.htm#statug_surveyselect_syntax.htm"&gt;SAS/STAT(R) 12.1 User's Guide&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 13:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-an-Index-Date-to-a-patient/m-p/137842#M27861</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-01-27T13:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly assigning an Index Date to a patient</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-an-Index-Date-to-a-patient/m-p/137843#M27862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It gives specifications for random seed generation.&lt;/P&gt;&lt;P&gt;Used for replicating results, i.e if we run the program more than once with same seed number, output will be the same; But if we change the seed number, output will be different.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 14:33:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-an-Index-Date-to-a-patient/m-p/137843#M27862</guid>
      <dc:creator>Phaneendra</dc:creator>
      <dc:date>2015-01-27T14:33:29Z</dc:date>
    </item>
  </channel>
</rss>

