<?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 running a code multiple times on a random sample in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/running-a-code-multiple-times-on-a-random-sample/m-p/443947#M2177</link>
    <description>&lt;P&gt;I am using proc surveyselect to select a random sample of 250 people from the dataset called baseline_followup. I then modify the new random sample to assign everyone a value of 0 for the Ycat variable. I merge the new dataset i named control2 with existing dataset called case. I then go ahead to find the odds ratio of the variables xcat and ycat.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there a way to run this same code 100 times and find the average odds ratio? because surveyselect will always randomly selected different people. So I want to calculate the 100 different odds ratios and find the average.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is the code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc surveyselect data=baseline_followup&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;out=control2&lt;BR /&gt;method= srs&lt;BR /&gt;sampsize=250;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data control2;&lt;BR /&gt;modify control2;&lt;BR /&gt;Ycat=0;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data casecontrol2;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;set case control2;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data=casecontrol2 order=formatted;&lt;BR /&gt;table xcat*ycat/relrisk;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Mar 2018 01:32:48 GMT</pubDate>
    <dc:creator>amin1234</dc:creator>
    <dc:date>2018-03-09T01:32:48Z</dc:date>
    <item>
      <title>running a code multiple times on a random sample</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/running-a-code-multiple-times-on-a-random-sample/m-p/443947#M2177</link>
      <description>&lt;P&gt;I am using proc surveyselect to select a random sample of 250 people from the dataset called baseline_followup. I then modify the new random sample to assign everyone a value of 0 for the Ycat variable. I merge the new dataset i named control2 with existing dataset called case. I then go ahead to find the odds ratio of the variables xcat and ycat.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there a way to run this same code 100 times and find the average odds ratio? because surveyselect will always randomly selected different people. So I want to calculate the 100 different odds ratios and find the average.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is the code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc surveyselect data=baseline_followup&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;out=control2&lt;BR /&gt;method= srs&lt;BR /&gt;sampsize=250;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data control2;&lt;BR /&gt;modify control2;&lt;BR /&gt;Ycat=0;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data casecontrol2;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;set case control2;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data=casecontrol2 order=formatted;&lt;BR /&gt;table xcat*ycat/relrisk;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 01:32:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/running-a-code-multiple-times-on-a-random-sample/m-p/443947#M2177</guid>
      <dc:creator>amin1234</dc:creator>
      <dc:date>2018-03-09T01:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: running a code multiple times on a random sample</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/running-a-code-multiple-times-on-a-random-sample/m-p/443950#M2178</link>
      <description>&lt;P&gt;can you not generate eg 1000 random samples and then use a by statement (by samp) in the proc freq?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 01:49:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/running-a-code-multiple-times-on-a-random-sample/m-p/443950#M2178</guid>
      <dc:creator>pau13rown</dc:creator>
      <dc:date>2018-03-09T01:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: running a code multiple times on a random sample</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/running-a-code-multiple-times-on-a-random-sample/m-p/443974#M2179</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/183379"&gt;@pau13rown&lt;/a&gt;&amp;nbsp;for your reply. Yes, I can generate 100 random samples. It combines all of them into one dataset. So i can run a proc freq in addition with a by statement to see the frequencies for each replicate. However, I combine the new 100 random samples with another dataset. Replicate values are missing. and so i do not know how to calculate the odds ratio of that. I will appreciate it if you can post a sample code of any method or ideas.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 04:23:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/running-a-code-multiple-times-on-a-random-sample/m-p/443974#M2179</guid>
      <dc:creator>amin1234</dc:creator>
      <dc:date>2018-03-09T04:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: running a code multiple times on a random sample</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/running-a-code-multiple-times-on-a-random-sample/m-p/443977#M2180</link>
      <description>&lt;P&gt;Use &lt;STRONG&gt;OUTHITS&lt;/STRONG&gt; in the surveyselect statement to get separate copies of replicates. Or use a &lt;STRONG&gt;weight numberhits;&lt;/STRONG&gt;&amp;nbsp;statement in proc freq.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 04:29:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/running-a-code-multiple-times-on-a-random-sample/m-p/443977#M2180</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-03-09T04:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: running a code multiple times on a random sample</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/running-a-code-multiple-times-on-a-random-sample/m-p/445726#M2181</link>
      <description>&lt;P&gt;Thank you all for your responses and ideas! This is how I finally solved it.&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%MACRO domean;&lt;BR /&gt;%DO I = 1 %TO 100;&lt;BR /&gt;proc surveyselect data=baseline_followup&lt;BR /&gt;out=controlmac&amp;amp;i&lt;BR /&gt;method= srs&lt;BR /&gt;sampsize=250;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data controlmac&amp;amp;i;&lt;BR /&gt;modify controlmac&amp;amp;i;&lt;BR /&gt;Ycat=0;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data casecohort&amp;amp;i;&lt;BR /&gt;set case controlmac&amp;amp;i;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;ods trace on;&lt;BR /&gt;proc freq data=casecohort&amp;amp;i order=formatted;&lt;BR /&gt;table xcat*ycat/relrisk;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;ods trace off;&lt;/P&gt;&lt;P&gt;ods output RelativeRisks=Output&amp;amp;i;&lt;BR /&gt;proc freq data=casecohort&amp;amp;i order=formatted;&lt;BR /&gt;table xcat*ycat/relrisk;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc print data=Output&amp;amp;i noobs;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%END;&lt;BR /&gt;%MEND domean;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%domean&lt;/P&gt;&lt;P&gt;data allrelrisk; set output1-output100;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data onlyodds; set allrelrisk;&lt;BR /&gt;where studytype not like 'Co%)';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc means mean data=onlyodds;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 04:42:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/running-a-code-multiple-times-on-a-random-sample/m-p/445726#M2181</guid>
      <dc:creator>amin1234</dc:creator>
      <dc:date>2018-03-15T04:42:12Z</dc:date>
    </item>
  </channel>
</rss>

