<?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 a loop for clinical trials in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/creating-a-loop-for-clinical-trials/m-p/471573#M120801</link>
    <description>&lt;P&gt;Hi, I am sorry here is an updated question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variable Mjk is going to look at the X variable and the fac variable for each subject and update the allocation based on each subject.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the data set should look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Subject&amp;nbsp; &amp;nbsp;Fac&amp;nbsp; &amp;nbsp;X&amp;nbsp; &amp;nbsp; &amp;nbsp; Treatment&amp;nbsp; M&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XjA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M2A&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XjB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;M1B&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XjC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;C&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;M2C&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XjA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M3A&lt;/P&gt;&lt;P&gt;........&lt;/P&gt;&lt;P&gt;2310&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; XjC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;M1A&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jun 2018 01:26:52 GMT</pubDate>
    <dc:creator>azt5173</dc:creator>
    <dc:date>2018-06-20T01:26:52Z</dc:date>
    <item>
      <title>creating a loop for clinical trials</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-loop-for-clinical-trials/m-p/471490#M120776</link>
      <description>&lt;P&gt;I am working on a clinical trial with 2310 subjects where I have to randomize treatments. The randomization consists of one factor(fac) "Age" where the categories are "1" if &amp;gt;18 and" 2" if 6 to &amp;lt;18 and "3" if &amp;lt;6. The treatments are A, B,C. The initial enrollment for each subject is defined as Xjk where K is the treatment(A, B, C) and j is the age factor(1,2,3). So you would have XjA, XjB and Xjc possibilities for each subject. The initial data looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Subject&amp;nbsp; &amp;nbsp;Fac&amp;nbsp; &amp;nbsp;X&amp;nbsp; &amp;nbsp; &amp;nbsp; Treatment&amp;nbsp;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XjA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XjB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XjC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;C&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XjA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&lt;/P&gt;&lt;P&gt;........&lt;/P&gt;&lt;P&gt;2310&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; XjC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to design a variable(Mjk) that's going to count the updated allocation if a new subject with a different j value is going to come in, for example M11 would be where age factor=1(j) and treatment=1(k) for the particular subject, M12 would be age factor=1 and treatment=2 for that subject, so I need to check within each subject and I am not sure how to do that. I am very new to SAS so I don't know how to design this in loops, I initially did an if/else statement but this was not accounting for each new subject. The initial code is shown below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data m12;&lt;BR /&gt;set data;&lt;BR /&gt;if fac1="1" then do;&lt;BR /&gt;if X="XjB" and t="2" then M="M12";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data m13;&lt;BR /&gt;set data;&lt;BR /&gt;if fac1="1" then do;&lt;BR /&gt;if X="Xjc" and t="3" then m="m13";&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help at all would be greatly appreciated! Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 19:19:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-loop-for-clinical-trials/m-p/471490#M120776</guid>
      <dc:creator>azt5173</dc:creator>
      <dc:date>2018-06-19T19:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: creating a loop for clinical trials</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-loop-for-clinical-trials/m-p/471559#M120799</link>
      <description>&lt;P&gt;Sorry your question is unclear.&lt;/P&gt;
&lt;P&gt;What's the output you expect for the example you provided?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 23:29:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-loop-for-clinical-trials/m-p/471559#M120799</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-06-19T23:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: creating a loop for clinical trials</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-loop-for-clinical-trials/m-p/471573#M120801</link>
      <description>&lt;P&gt;Hi, I am sorry here is an updated question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variable Mjk is going to look at the X variable and the fac variable for each subject and update the allocation based on each subject.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the data set should look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Subject&amp;nbsp; &amp;nbsp;Fac&amp;nbsp; &amp;nbsp;X&amp;nbsp; &amp;nbsp; &amp;nbsp; Treatment&amp;nbsp; M&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XjA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M2A&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XjB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;M1B&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XjC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;C&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;M2C&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;XjA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M3A&lt;/P&gt;&lt;P&gt;........&lt;/P&gt;&lt;P&gt;2310&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; XjC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;M1A&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 01:26:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-loop-for-clinical-trials/m-p/471573#M120801</guid>
      <dc:creator>azt5173</dc:creator>
      <dc:date>2018-06-20T01:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: creating a loop for clinical trials</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-loop-for-clinical-trials/m-p/471575#M120803</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;M = catt('M', FAC, TREATMENT);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 01:42:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-loop-for-clinical-trials/m-p/471575#M120803</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-06-20T01:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: creating a loop for clinical trials</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-loop-for-clinical-trials/m-p/471576#M120804</link>
      <description>&lt;P&gt;Yes but how would I check for the "fac" of each subject within the data set? The variable M should update after each subject.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 01:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-loop-for-clinical-trials/m-p/471576#M120804</guid>
      <dc:creator>azt5173</dc:creator>
      <dc:date>2018-06-20T01:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: creating a loop for clinical trials</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-loop-for-clinical-trials/m-p/471581#M120806</link>
      <description>&lt;P&gt;The data step executes for each observation. This works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data m12;
  set data;
  M = catt('M', FAC, TREATMENT);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jun 2018 02:47:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-loop-for-clinical-trials/m-p/471581#M120806</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-06-20T02:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: creating a loop for clinical trials</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-loop-for-clinical-trials/m-p/471642#M120834</link>
      <description>Okay, thank you I will try it.&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Jun 2018 10:46:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-loop-for-clinical-trials/m-p/471642#M120834</guid>
      <dc:creator>azt5173</dc:creator>
      <dc:date>2018-06-20T10:46:40Z</dc:date>
    </item>
  </channel>
</rss>

