<?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: split of number of subjects in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/split-of-number-of-subjects/m-p/277853#M55852</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't have access to SAS at the moment, so this is untested but (and note the reason this is so complicated is because of your data setup and having the ratio like that) :&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  array sp{3} 8.;
  do i=1 to countc(split,":")+1;
    sp{i}=input(scan(split,i,":"),best.);
  end;
  totsplit=sum(of sp{*});
  main_treat=put((no_of_subj / totsplit) * sp{1},best.);
  comparator1=put((no_of_subj / totsplit) * sp{2},best.);
  comparator2=put((no_of_subj / totsplit) * sp{3},best.);
run;
      &lt;/PRE&gt;</description>
    <pubDate>Thu, 16 Jun 2016 11:03:56 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-06-16T11:03:56Z</dc:date>
    <item>
      <title>split of number of subjects</title>
      <link>https://communities.sas.com/t5/SAS-Programming/split-of-number-of-subjects/m-p/277851#M55850</link>
      <description>&lt;P&gt;I have dataset which has the following variables.&lt;/P&gt;
&lt;TABLE width="486"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="72"&gt;trial_id&lt;/TD&gt;
&lt;TD width="78"&gt;main_treat&lt;/TD&gt;
&lt;TD width="95"&gt;comparator1&amp;nbsp;&lt;/TD&gt;
&lt;TD width="90"&gt;comparator2&lt;/TD&gt;
&lt;TD width="79"&gt;no_of_subj&lt;/TD&gt;
&lt;TD width="72"&gt;split&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;aaa&lt;/TD&gt;
&lt;TD&gt;inv&lt;/TD&gt;
&lt;TD&gt;none&lt;/TD&gt;
&lt;TD&gt;234&lt;/TD&gt;
&lt;TD&gt;1:1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;dsd&lt;/TD&gt;
&lt;TD&gt;hfg&lt;/TD&gt;
&lt;TD&gt;sfdg&lt;/TD&gt;
&lt;TD&gt;123&lt;/TD&gt;
&lt;TD&gt;1:1:1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;aaa&lt;/TD&gt;
&lt;TD&gt;dfs&lt;/TD&gt;
&lt;TD&gt;none&lt;/TD&gt;
&lt;TD&gt;156&lt;/TD&gt;
&lt;TD&gt;1:2&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to replace main_treat and comp1 and comp2 with the split.&lt;/P&gt;
&lt;P&gt;For ex for trial_id =1 it should have main_treat=234/2=117, comparator1=234/2=11 and comparator2=" ".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you help me in this how to do in efficient way&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2016 10:53:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/split-of-number-of-subjects/m-p/277851#M55850</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2016-06-16T10:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: split of number of subjects</title>
      <link>https://communities.sas.com/t5/SAS-Programming/split-of-number-of-subjects/m-p/277853#M55852</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't have access to SAS at the moment, so this is untested but (and note the reason this is so complicated is because of your data setup and having the ratio like that) :&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  array sp{3} 8.;
  do i=1 to countc(split,":")+1;
    sp{i}=input(scan(split,i,":"),best.);
  end;
  totsplit=sum(of sp{*});
  main_treat=put((no_of_subj / totsplit) * sp{1},best.);
  comparator1=put((no_of_subj / totsplit) * sp{2},best.);
  comparator2=put((no_of_subj / totsplit) * sp{3},best.);
run;
      &lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Jun 2016 11:03:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/split-of-number-of-subjects/m-p/277853#M55852</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-06-16T11:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: split of number of subjects</title>
      <link>https://communities.sas.com/t5/SAS-Programming/split-of-number-of-subjects/m-p/283250#M57720</link>
      <description>&lt;P&gt;Further to the above code i also need to set up a condition. If condition=1 then split by 1:1(half) and if condition=2 then split equally.&lt;/P&gt;
&lt;P&gt;example for cond 2 if the value is 42 then it should be 42 for all the 3 columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can any one help how to do in this code.&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  array sp{3} 8.;
  do i=1 to countc(split,":")+1;
    sp{i}=input(scan(split,i,":"),best.);
  end;
  totsplit=sum(of sp{*});
  main_treat=put((no_of_subj / totsplit) * sp{1},best.);
  comparator1=put((no_of_subj / totsplit) * sp{2},best.);
  comparator2=put((no_of_subj / totsplit) * sp{3},best.);
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jul 2016 06:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/split-of-number-of-subjects/m-p/283250#M57720</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2016-07-11T06:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: split of number of subjects</title>
      <link>https://communities.sas.com/t5/SAS-Programming/split-of-number-of-subjects/m-p/283258#M57725</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would be a good idea to start a new topic, posting test data (in the form of a datastep) and what the output should look like. &amp;nbsp;Your logic isn't particularly clear to me, however it should just be a matter of putting an if &amp;lt;&amp;gt; statement around the sp{*} array.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2016 08:25:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/split-of-number-of-subjects/m-p/283258#M57725</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-07-11T08:25:48Z</dc:date>
    </item>
  </channel>
</rss>

