<?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 Randomization for stratified unequal allocation ratio in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Randomization-for-stratified-unequal-allocation-ratio/m-p/901595#M356297</link>
    <description>&lt;P&gt;I have 60 patients, 5 cohorts where in each there are 4 female and 8 male. In each cohort the allocation ratio for female is (3:1) so 3 treatment and 1 placebo. And for male is (6:2) so 6 treatment and 2 placebo.&lt;BR /&gt;Cohort 1 has the 150 mg dose&lt;BR /&gt;Cohort 2 has 200 mg&lt;BR /&gt;Cohort 3 has 250 mg&lt;BR /&gt;Cohort 4 is "optional treatment"&lt;BR /&gt;Cohort 5 is "optional treatment"&lt;/P&gt;&lt;P&gt;I need to create a randomization code in a way that the final output looks like below:&lt;/P&gt;&lt;P&gt;## Cohort 1 - 150 mg ##&lt;BR /&gt;## Female ##&lt;/P&gt;&lt;P&gt;| Randomization number | Treatment |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| 101 | Treatment |&lt;BR /&gt;| 102 | Placebo |&lt;BR /&gt;| 103 | Treatment |&lt;BR /&gt;| 104 | Treatment |&lt;/P&gt;&lt;P&gt;## Cohort 1 - 150 mg ##&lt;BR /&gt;## Female ##&lt;/P&gt;&lt;P&gt;| Treatment | Count |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| Treatment | 3 |&lt;BR /&gt;| Placebo | 1 |&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cohort 1 - 150 mg&lt;BR /&gt;## Male ##&lt;/P&gt;&lt;P&gt;| Randomization number | Treatment |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| 105 | Treatment |&lt;BR /&gt;| 106 | Treatment |&lt;BR /&gt;| 107 | Treatment |&lt;BR /&gt;| 108 | Placebo |&lt;BR /&gt;| 109 | Treatment |&lt;BR /&gt;| 110 | Treatment |&lt;BR /&gt;| 111 | Treatment |&lt;BR /&gt;| 112 | Placebo |&lt;BR /&gt;## Cohort 1 - 150 mg ##&lt;BR /&gt;## Male ##&lt;/P&gt;&lt;P&gt;| Treatment | Count |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| Treatment | 6 |&lt;BR /&gt;| Placebo | 2 |&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;## Cohort 2 - 200 mg ##&lt;BR /&gt;## Female ##&lt;/P&gt;&lt;P&gt;| Randomization number | Treatment |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| 201 | Treatment |&lt;BR /&gt;| 202 | Treatment |&lt;BR /&gt;| 203 | Treatment |&lt;BR /&gt;| 204 | Placebo |&lt;/P&gt;&lt;P&gt;## Cohort 2 - 200 mg ##&lt;BR /&gt;## Female ##&lt;/P&gt;&lt;P&gt;| Treatment | Count |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| Treatment | 3 |&lt;BR /&gt;| Placebo | 1 |&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cohort 2 - 200 mg&lt;BR /&gt;## Male ##&lt;/P&gt;&lt;P&gt;| Randomization number | Treatment |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| 205 | Placebo |&lt;BR /&gt;| 206 | Treatment |&lt;BR /&gt;| 207 | Treatment |&lt;BR /&gt;| 208 | Placebo |&lt;BR /&gt;| 209 | Treatment |&lt;BR /&gt;| 210 | Treatment |&lt;BR /&gt;| 211 | Treatment |&lt;BR /&gt;| 212 | Treatment |&lt;/P&gt;&lt;P&gt;## Cohort 2 - 200 mg ##&lt;BR /&gt;## Male ##&lt;/P&gt;&lt;P&gt;| Treatment | Count |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| Treatment | 6 |&lt;BR /&gt;| Placebo | 2 |&lt;/P&gt;&lt;P&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;Up to cohort 5:&lt;/P&gt;&lt;P&gt;## Cohort 5 - Optional dose ##&lt;BR /&gt;## Female ##&lt;/P&gt;&lt;P&gt;| Randomization number | Treatment |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| 501 | Treatment |&lt;BR /&gt;| 502 | Treatment |&lt;BR /&gt;| 503 | Placebo |&lt;BR /&gt;| 504 | Treatment |&lt;/P&gt;&lt;P&gt;## Cohort 5 - Optional dose ##&lt;BR /&gt;## Female ##&lt;/P&gt;&lt;P&gt;| Treatment | Count |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| Treatment | 3 |&lt;BR /&gt;| Placebo | 1 |&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cohort 5 - Optional dose&lt;BR /&gt;## Male ##&lt;/P&gt;&lt;P&gt;| Randomization number | Treatment |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| 505 | Treatment |&lt;BR /&gt;| 506 | Treatment |&lt;BR /&gt;| 507 | Treatment |&lt;BR /&gt;| 508 | Treatment |&lt;BR /&gt;| 509 | Treatment |&lt;BR /&gt;| 510 | Treatment |&lt;BR /&gt;| 511 | Placebo |&lt;BR /&gt;| 512 | Placebo |&lt;/P&gt;&lt;P&gt;## Cohort 1 - Optional dose ##&lt;BR /&gt;## Male ##&lt;/P&gt;&lt;P&gt;| Treatment | Count |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| Treatment | 6 |&lt;BR /&gt;| Placebo | 2 |&lt;/P&gt;&lt;P&gt;then I need to create a pdf output, an excel output and the sas output. In addition, I want a pdf output in a way that each randomization number for each male and female and the allocated treatment/placebo be printed separately on each pdf page.&lt;/P&gt;&lt;P&gt;I also need the same exact output but with the following randomization number (where in the title for each page, a "replacement" will be added):&lt;/P&gt;&lt;P&gt;Female cohort 1: 181 182 183 184&lt;BR /&gt;Male cohort 1: 185 186 187 188 189 190 191 192&lt;/P&gt;&lt;P&gt;Female cohort 2: 281 282 283 284&lt;BR /&gt;Male Cohort 2: 285 286 287 288 289 290 292 292&lt;/P&gt;&lt;P&gt;up to cohort 5:&lt;BR /&gt;581,...,585 (female)&lt;BR /&gt;585,...,592 (male)&lt;/P&gt;&lt;P&gt;Which I am having hard time creating them as I am not familiar with SAS programming at all. This is what I worked on so far but the problem is I could only do it for the equal number of male and female in each cohort and I cannot separate them in a way that in one pdf page I get female and the next page male (like the above output) and also having hard time creating the randomization number as above.&lt;/P&gt;&lt;P&gt;```&lt;BR /&gt;options ls=132 ps=58 nodate nonumber; title1 "RANDOMIZATION SCHEDULE"; title2 "A Randomized, Double-Blind, Placebo-Controlled, MAD Study";&lt;BR /&gt;%let seed=9683473;&lt;BR /&gt;data rannum(keep=seed);&lt;BR /&gt;do i=1 to 5;&lt;BR /&gt;rannum=ranuni(&amp;amp;seed);&lt;BR /&gt;seed=int(rannum*1000000);&lt;BR /&gt;output;&lt;BR /&gt;end; run;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select seed&lt;BR /&gt;into :seed1 - :seed5&lt;BR /&gt;from rannum;&lt;BR /&gt;quit;&lt;BR /&gt;proc format;&lt;/P&gt;&lt;P&gt;value sex 1='Female'&lt;BR /&gt;2='Male';&lt;BR /&gt;value treat 1='Placebo'&lt;BR /&gt;2='150 mg'&lt;BR /&gt;3='200 mg'&lt;BR /&gt;4='250 mg'&lt;BR /&gt;5='optional dose'&lt;BR /&gt;6='optional dose';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc plan seed=&amp;amp;seed1;&lt;BR /&gt;factors sex=2 treat=12 /noprint;&lt;BR /&gt;output out=data1&lt;BR /&gt;sex nvals=(1 2) random&lt;BR /&gt;treat nvals=(1 1 1 2 2 2 2 2 2 2 2)&lt;BR /&gt;random;&lt;BR /&gt;run;&lt;BR /&gt;proc plan seed=&amp;amp;seed2;&lt;BR /&gt;factors sex=2 treat=12 /noprint;&lt;BR /&gt;output out=data2&lt;BR /&gt;sex nvals=(1 2) random&lt;BR /&gt;treat nvals=(1 1 1 3 3 3 3 3 3 3 3)&lt;BR /&gt;random;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc plan seed=&amp;amp;seed3;&lt;BR /&gt;factors sex=2 treat=12 /noprint;&lt;BR /&gt;output out=data3&lt;BR /&gt;sex nvals=(1 2) random&lt;BR /&gt;treat nvals=(1 1 14 4 4 4 4 4 4 4)&lt;BR /&gt;random;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc plan seed=&amp;amp;seed4;&lt;BR /&gt;factors sex=2 treat=12 /noprint;&lt;BR /&gt;output out=data4&lt;BR /&gt;sex nvals=(1 2) random&lt;BR /&gt;treat nvals=(1 1 1 5 5 5 5 5 5 5 5)&lt;BR /&gt;random;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc plan seed=&amp;amp;seed5;&lt;BR /&gt;factors sex=2 treat=12 /noprint;&lt;BR /&gt;output out=data5&lt;BR /&gt;sex nvals=(1 2) random&lt;BR /&gt;treat nvals=(1 1 1 6 6 6 6 6 6 6 6)&lt;BR /&gt;random;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%macro combine(dataset);&lt;BR /&gt;%do i=1 %to 5;&lt;BR /&gt;%let dataset=data&amp;amp;i;&lt;BR /&gt;proc sort data=&amp;amp;dataset; by sex;&lt;BR /&gt;data &amp;amp;dataset;&lt;BR /&gt;set &amp;amp;dataset;&lt;BR /&gt;cohort=&amp;amp;i;&lt;BR /&gt;subid=%eval(&amp;amp;i.00)+(_n_);&lt;BR /&gt;%end; %mend;&lt;BR /&gt;%combine&lt;BR /&gt;data combine;&lt;BR /&gt;set data1 data2 data3 data4 data5&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort; by cohort sex;&lt;/P&gt;&lt;P&gt;print data=combine noobs double&lt;BR /&gt;proc&lt;BR /&gt;uniform split='*';&lt;BR /&gt;var sex subid treat;&lt;BR /&gt;id cohort;&lt;BR /&gt;by cohort;&lt;BR /&gt;label subid="Randomization number"&lt;BR /&gt;treat="TREATMENT";&lt;BR /&gt;format treat treat.;&lt;BR /&gt;run;&lt;BR /&gt;```&lt;/P&gt;</description>
    <pubDate>Sat, 04 Nov 2023 21:42:04 GMT</pubDate>
    <dc:creator>hagml</dc:creator>
    <dc:date>2023-11-04T21:42:04Z</dc:date>
    <item>
      <title>Randomization for stratified unequal allocation ratio</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomization-for-stratified-unequal-allocation-ratio/m-p/901595#M356297</link>
      <description>&lt;P&gt;I have 60 patients, 5 cohorts where in each there are 4 female and 8 male. In each cohort the allocation ratio for female is (3:1) so 3 treatment and 1 placebo. And for male is (6:2) so 6 treatment and 2 placebo.&lt;BR /&gt;Cohort 1 has the 150 mg dose&lt;BR /&gt;Cohort 2 has 200 mg&lt;BR /&gt;Cohort 3 has 250 mg&lt;BR /&gt;Cohort 4 is "optional treatment"&lt;BR /&gt;Cohort 5 is "optional treatment"&lt;/P&gt;&lt;P&gt;I need to create a randomization code in a way that the final output looks like below:&lt;/P&gt;&lt;P&gt;## Cohort 1 - 150 mg ##&lt;BR /&gt;## Female ##&lt;/P&gt;&lt;P&gt;| Randomization number | Treatment |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| 101 | Treatment |&lt;BR /&gt;| 102 | Placebo |&lt;BR /&gt;| 103 | Treatment |&lt;BR /&gt;| 104 | Treatment |&lt;/P&gt;&lt;P&gt;## Cohort 1 - 150 mg ##&lt;BR /&gt;## Female ##&lt;/P&gt;&lt;P&gt;| Treatment | Count |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| Treatment | 3 |&lt;BR /&gt;| Placebo | 1 |&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cohort 1 - 150 mg&lt;BR /&gt;## Male ##&lt;/P&gt;&lt;P&gt;| Randomization number | Treatment |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| 105 | Treatment |&lt;BR /&gt;| 106 | Treatment |&lt;BR /&gt;| 107 | Treatment |&lt;BR /&gt;| 108 | Placebo |&lt;BR /&gt;| 109 | Treatment |&lt;BR /&gt;| 110 | Treatment |&lt;BR /&gt;| 111 | Treatment |&lt;BR /&gt;| 112 | Placebo |&lt;BR /&gt;## Cohort 1 - 150 mg ##&lt;BR /&gt;## Male ##&lt;/P&gt;&lt;P&gt;| Treatment | Count |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| Treatment | 6 |&lt;BR /&gt;| Placebo | 2 |&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;## Cohort 2 - 200 mg ##&lt;BR /&gt;## Female ##&lt;/P&gt;&lt;P&gt;| Randomization number | Treatment |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| 201 | Treatment |&lt;BR /&gt;| 202 | Treatment |&lt;BR /&gt;| 203 | Treatment |&lt;BR /&gt;| 204 | Placebo |&lt;/P&gt;&lt;P&gt;## Cohort 2 - 200 mg ##&lt;BR /&gt;## Female ##&lt;/P&gt;&lt;P&gt;| Treatment | Count |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| Treatment | 3 |&lt;BR /&gt;| Placebo | 1 |&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cohort 2 - 200 mg&lt;BR /&gt;## Male ##&lt;/P&gt;&lt;P&gt;| Randomization number | Treatment |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| 205 | Placebo |&lt;BR /&gt;| 206 | Treatment |&lt;BR /&gt;| 207 | Treatment |&lt;BR /&gt;| 208 | Placebo |&lt;BR /&gt;| 209 | Treatment |&lt;BR /&gt;| 210 | Treatment |&lt;BR /&gt;| 211 | Treatment |&lt;BR /&gt;| 212 | Treatment |&lt;/P&gt;&lt;P&gt;## Cohort 2 - 200 mg ##&lt;BR /&gt;## Male ##&lt;/P&gt;&lt;P&gt;| Treatment | Count |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| Treatment | 6 |&lt;BR /&gt;| Placebo | 2 |&lt;/P&gt;&lt;P&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;Up to cohort 5:&lt;/P&gt;&lt;P&gt;## Cohort 5 - Optional dose ##&lt;BR /&gt;## Female ##&lt;/P&gt;&lt;P&gt;| Randomization number | Treatment |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| 501 | Treatment |&lt;BR /&gt;| 502 | Treatment |&lt;BR /&gt;| 503 | Placebo |&lt;BR /&gt;| 504 | Treatment |&lt;/P&gt;&lt;P&gt;## Cohort 5 - Optional dose ##&lt;BR /&gt;## Female ##&lt;/P&gt;&lt;P&gt;| Treatment | Count |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| Treatment | 3 |&lt;BR /&gt;| Placebo | 1 |&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cohort 5 - Optional dose&lt;BR /&gt;## Male ##&lt;/P&gt;&lt;P&gt;| Randomization number | Treatment |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| 505 | Treatment |&lt;BR /&gt;| 506 | Treatment |&lt;BR /&gt;| 507 | Treatment |&lt;BR /&gt;| 508 | Treatment |&lt;BR /&gt;| 509 | Treatment |&lt;BR /&gt;| 510 | Treatment |&lt;BR /&gt;| 511 | Placebo |&lt;BR /&gt;| 512 | Placebo |&lt;/P&gt;&lt;P&gt;## Cohort 1 - Optional dose ##&lt;BR /&gt;## Male ##&lt;/P&gt;&lt;P&gt;| Treatment | Count |&lt;BR /&gt;| -------- | -------------- |&lt;BR /&gt;| Treatment | 6 |&lt;BR /&gt;| Placebo | 2 |&lt;/P&gt;&lt;P&gt;then I need to create a pdf output, an excel output and the sas output. In addition, I want a pdf output in a way that each randomization number for each male and female and the allocated treatment/placebo be printed separately on each pdf page.&lt;/P&gt;&lt;P&gt;I also need the same exact output but with the following randomization number (where in the title for each page, a "replacement" will be added):&lt;/P&gt;&lt;P&gt;Female cohort 1: 181 182 183 184&lt;BR /&gt;Male cohort 1: 185 186 187 188 189 190 191 192&lt;/P&gt;&lt;P&gt;Female cohort 2: 281 282 283 284&lt;BR /&gt;Male Cohort 2: 285 286 287 288 289 290 292 292&lt;/P&gt;&lt;P&gt;up to cohort 5:&lt;BR /&gt;581,...,585 (female)&lt;BR /&gt;585,...,592 (male)&lt;/P&gt;&lt;P&gt;Which I am having hard time creating them as I am not familiar with SAS programming at all. This is what I worked on so far but the problem is I could only do it for the equal number of male and female in each cohort and I cannot separate them in a way that in one pdf page I get female and the next page male (like the above output) and also having hard time creating the randomization number as above.&lt;/P&gt;&lt;P&gt;```&lt;BR /&gt;options ls=132 ps=58 nodate nonumber; title1 "RANDOMIZATION SCHEDULE"; title2 "A Randomized, Double-Blind, Placebo-Controlled, MAD Study";&lt;BR /&gt;%let seed=9683473;&lt;BR /&gt;data rannum(keep=seed);&lt;BR /&gt;do i=1 to 5;&lt;BR /&gt;rannum=ranuni(&amp;amp;seed);&lt;BR /&gt;seed=int(rannum*1000000);&lt;BR /&gt;output;&lt;BR /&gt;end; run;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select seed&lt;BR /&gt;into :seed1 - :seed5&lt;BR /&gt;from rannum;&lt;BR /&gt;quit;&lt;BR /&gt;proc format;&lt;/P&gt;&lt;P&gt;value sex 1='Female'&lt;BR /&gt;2='Male';&lt;BR /&gt;value treat 1='Placebo'&lt;BR /&gt;2='150 mg'&lt;BR /&gt;3='200 mg'&lt;BR /&gt;4='250 mg'&lt;BR /&gt;5='optional dose'&lt;BR /&gt;6='optional dose';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc plan seed=&amp;amp;seed1;&lt;BR /&gt;factors sex=2 treat=12 /noprint;&lt;BR /&gt;output out=data1&lt;BR /&gt;sex nvals=(1 2) random&lt;BR /&gt;treat nvals=(1 1 1 2 2 2 2 2 2 2 2)&lt;BR /&gt;random;&lt;BR /&gt;run;&lt;BR /&gt;proc plan seed=&amp;amp;seed2;&lt;BR /&gt;factors sex=2 treat=12 /noprint;&lt;BR /&gt;output out=data2&lt;BR /&gt;sex nvals=(1 2) random&lt;BR /&gt;treat nvals=(1 1 1 3 3 3 3 3 3 3 3)&lt;BR /&gt;random;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc plan seed=&amp;amp;seed3;&lt;BR /&gt;factors sex=2 treat=12 /noprint;&lt;BR /&gt;output out=data3&lt;BR /&gt;sex nvals=(1 2) random&lt;BR /&gt;treat nvals=(1 1 14 4 4 4 4 4 4 4)&lt;BR /&gt;random;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc plan seed=&amp;amp;seed4;&lt;BR /&gt;factors sex=2 treat=12 /noprint;&lt;BR /&gt;output out=data4&lt;BR /&gt;sex nvals=(1 2) random&lt;BR /&gt;treat nvals=(1 1 1 5 5 5 5 5 5 5 5)&lt;BR /&gt;random;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc plan seed=&amp;amp;seed5;&lt;BR /&gt;factors sex=2 treat=12 /noprint;&lt;BR /&gt;output out=data5&lt;BR /&gt;sex nvals=(1 2) random&lt;BR /&gt;treat nvals=(1 1 1 6 6 6 6 6 6 6 6)&lt;BR /&gt;random;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%macro combine(dataset);&lt;BR /&gt;%do i=1 %to 5;&lt;BR /&gt;%let dataset=data&amp;amp;i;&lt;BR /&gt;proc sort data=&amp;amp;dataset; by sex;&lt;BR /&gt;data &amp;amp;dataset;&lt;BR /&gt;set &amp;amp;dataset;&lt;BR /&gt;cohort=&amp;amp;i;&lt;BR /&gt;subid=%eval(&amp;amp;i.00)+(_n_);&lt;BR /&gt;%end; %mend;&lt;BR /&gt;%combine&lt;BR /&gt;data combine;&lt;BR /&gt;set data1 data2 data3 data4 data5&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort; by cohort sex;&lt;/P&gt;&lt;P&gt;print data=combine noobs double&lt;BR /&gt;proc&lt;BR /&gt;uniform split='*';&lt;BR /&gt;var sex subid treat;&lt;BR /&gt;id cohort;&lt;BR /&gt;by cohort;&lt;BR /&gt;label subid="Randomization number"&lt;BR /&gt;treat="TREATMENT";&lt;BR /&gt;format treat treat.;&lt;BR /&gt;run;&lt;BR /&gt;```&lt;/P&gt;</description>
      <pubDate>Sat, 04 Nov 2023 21:42:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomization-for-stratified-unequal-allocation-ratio/m-p/901595#M356297</guid>
      <dc:creator>hagml</dc:creator>
      <dc:date>2023-11-04T21:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: Randomization for stratified unequal allocation ratio</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomization-for-stratified-unequal-allocation-ratio/m-p/901671#M356329</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
You are asking too much questions.
I have no time to follow all your questions.
The following code could give you a start
*/

proc plan seed=123  ;
factors cohorts=5 ordered subject=4 random/noprint;
treatments treat=4;
output out=female;
run;
factors cohorts=5 ordered subject=8 random/noprint;
treatments treat=8;
output out=male;
run;
quit;

data female;
 set female;
 length sex  treatment $ 20;
 sex='female';
 treatment=ifc(treat in (1:3),'treatment ','placebo');
run;
data male;
 set male;
 length sex treatment $ 20;
 sex='male';
 treatment=ifc(treat in (1:6),'treatment ','placebo');
run;
proc format;
value fmt
1='150 mg'
2='200 mg'
3='250 mg'
4='optional treatment'
5='optional treatment2' 
;
run;
data want;
 set female male(in=inb);
 by cohorts;
 subjectid=100*cohorts+subject+ifn(inb,4,0);
 format cohorts fmt.;
 label subjectid='Randomization number' treatment='Treatment';
run;

%macro print(sex=,cohorts=);
title "##Cohort: %cmpres(%sysfunc(putn(&amp;amp;cohorts.,fmt.)))##";
title2 "## &amp;amp;sex. ##";
proc report data=want nowd;
where upcase(sex)="%upcase(&amp;amp;sex.)" and cohorts=&amp;amp;cohorts.;
column subjectid treatment ;
define subjectid/order;
run;
proc sql;
select treatment,count(*) as Count from want where upcase(sex)="%upcase(&amp;amp;sex.)" and cohorts=&amp;amp;cohorts. group by treatment;
quit;
%mend;

options nodate nonumber;
ods pdf file='c:\temp\want.pdf' style=journal startpage=no;
%print(sex=female,cohorts=1)
ods pdf startpage=now;
%print(sex=female,cohorts=2)
ods pdf startpage=now;
%print(sex=female,cohorts=3)
ods pdf startpage=now;
%print(sex=female,cohorts=4)
ods pdf startpage=now;
%print(sex=female,cohorts=5)
ods pdf startpage=now;

%print(sex=male,cohorts=1)
ods pdf startpage=now;
%print(sex=male,cohorts=2)
ods pdf startpage=now;
%print(sex=male,cohorts=3)
ods pdf startpage=now;
%print(sex=male,cohorts=4)
ods pdf startpage=now;
%print(sex=male,cohorts=5)
ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Nov 2023 05:16:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomization-for-stratified-unequal-allocation-ratio/m-p/901671#M356329</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-11-06T05:16:53Z</dc:date>
    </item>
  </channel>
</rss>

