<?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: Coding Help for Homework problem in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Coding-Help-for-Homework-problem/m-p/791702#M10368</link>
    <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;I am having trouble with this homework problem. I do not know which procedure to use for this.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the DATA step.&lt;/P&gt;</description>
    <pubDate>Sun, 23 Jan 2022 11:07:08 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-01-23T11:07:08Z</dc:date>
    <item>
      <title>Coding Help for Homework problem</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Coding-Help-for-Homework-problem/m-p/783483#M10301</link>
      <description>&lt;P&gt;Hello all, I am a SAS Studio student, and I am having trouble with this homework problem. I do not know which procedure to use for this. I'd greatly appreciate any advice. Thanks in Advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;&lt;SPAN&gt;For determining sample size estimates for time dependent (survival) data, usually the number of estimated events (D) (e.g. deaths, rejections, relapse, reops, etc.) must first be calculated.&lt;BR /&gt;Once that is established, the total sample size (n) may be derived based on the percentage of patients that remain event-free at the end of the study. &lt;/SPAN&gt;&lt;SPAN&gt;The two equations for D and n are found below. &lt;/SPAN&gt;&lt;SPAN&gt;These equations are for the (Parametric) version of sample size determination for Survival Data or Time to Failure data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;D = total # of events required &lt;/SPAN&gt;&lt;SPAN&gt;α &lt;/SPAN&gt;&lt;SPAN&gt;= &lt;/SPAN&gt;&lt;SPAN&gt;Z critical value - Type I error &lt;/SPAN&gt;&lt;SPAN&gt;Β &lt;/SPAN&gt;&lt;SPAN&gt;= &lt;/SPAN&gt;&lt;SPAN&gt;Z critical value - Type II error &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Δ&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;hazardratio =&lt;/SPAN&gt;&lt;SPAN&gt;λ&lt;/SPAN&gt;&lt;SPAN&gt;Τ&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;λ&lt;/SPAN&gt;&lt;SPAN&gt;c&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;= &lt;/SPAN&gt;&lt;SPAN&gt;ln&lt;/SPAN&gt;&lt;SPAN&gt;π&lt;/SPAN&gt;&lt;SPAN&gt;T &lt;/SPAN&gt;&lt;SPAN&gt;/ln&lt;/SPAN&gt;&lt;SPAN&gt;π&lt;/SPAN&gt;&lt;SPAN&gt;C&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;n=D&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;&lt;SPAN&gt;Example: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;90% Power &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Δ &lt;/SPAN&gt;&lt;SPAN&gt;= 2.0 &lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;&lt;SPAN&gt;1 - %event-free &lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;&lt;SPAN&gt;D=4(1.96 + 1.282)^&lt;/SPAN&gt;&lt;SPAN&gt;2/[ln2]^2&lt;/SPAN&gt;&lt;SPAN&gt;= 87.5= 88 events&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This assumes that all participants will be followed until their event.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Suppose that previous studies suggest that 30% of subjects remain event-free at the end of trial. Then, sample size n&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;&lt;SPAN&gt;n = D/1 - %event-free = 88 / (1-0.30) = 125.7 = &lt;/SPAN&gt;&lt;SPAN&gt;126 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This number might be further inflated to account for dropout, but we won’t worry about that here.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;In SAS, write code to calculate D and n &lt;/U&gt;&lt;SPAN&gt;&lt;U&gt;for the following scenarios&lt;/U&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When alpha = 0.05 and the hazard ratio may be either 2.0 or 1.5, for power = 0.8 and also for power = 0.90. And either 30% or 20% of subjects remain event-free at the end of trial.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Do you see that you will have &lt;/SPAN&gt;&lt;SPAN&gt;8 pair of estimates &lt;/SPAN&gt;&lt;SPAN&gt;for D and n in your output? Please include your &lt;/SPAN&gt;&lt;SPAN&gt;SAS &lt;/SPAN&gt;&lt;SPAN&gt;code. Your estimate for D and n should be in integer form.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;&lt;SPAN&gt;Note:&lt;BR /&gt;Power&amp;nbsp; &amp;nbsp; Z(subscript B)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;80%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.84 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;90%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.28 &lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 01 Dec 2021 23:07:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Coding-Help-for-Homework-problem/m-p/783483#M10301</guid>
      <dc:creator>sascrazedpupil</dc:creator>
      <dc:date>2021-12-01T23:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Coding Help for Homework problem</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Coding-Help-for-Homework-problem/m-p/791701#M10367</link>
      <description>&lt;P&gt;Hi sascrazedpupil,&lt;/P&gt;&lt;P&gt;I tried to code this problem, and to be honest, I had to go through a few websites that could explain to me what Z(beta) and Z(alpha) were. Also, I have tried to double-guess how you are calculating the total number of events required, using the hazard ratio. I guessed that it must be inside the natural logarithm.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could declare a few global variables to do this more easily, but that won't solve your problem of having 8 obs in the final table.&lt;/P&gt;&lt;P&gt;So I went ahead and created 8 obs in my initial data table, for 8 possible selections, from the available values of alpha, power and % event free. (The number of obs would be 2^(number of variables)). I did this using datalines. I don't see how there could be a way to have this more dynamic, and yet have eight obs in the final data table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The layout of the code is pretty simple. If you do find any mistake in the formula, then it is going to be easily edittable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please go through the code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data temp;
input alpha Z_alpha Power  Delta event_free;
datalines;
0.05 1.96 0.8 2 0.3
0.05 1.96 0.8 1.5 0.3
0.05 1.96 0.9 2 0.3
0.05 1.96 0.9 1.5 0.3
0.05 1.96 0.8 2 0.2
0.05 1.96 0.8 1.5 0.2
0.05 1.96 0.9 2 0.2
0.05 1.96 0.9 1.5 0.2
;
run;

data temp2;
set temp;
beta = 1-power;
if power = 0.8 then Z_1_minus_Beta = 0.842;
else Z_1_minus_Beta = 1.28;
D = round((4*(Z_alpha + Z_1_minus_Beta)**2)/(log(delta))**2);
n = round(D/(1-event_free));

run;

proc print data=temp2; run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This is what the final report looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SaketChaudhari_0-1642930154728.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67633i583668D7631FCD6E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SaketChaudhari_0-1642930154728.png" alt="SaketChaudhari_0-1642930154728.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jan 2022 09:33:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Coding-Help-for-Homework-problem/m-p/791701#M10367</guid>
      <dc:creator>SaketChaudhari</dc:creator>
      <dc:date>2022-01-23T09:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Coding Help for Homework problem</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Coding-Help-for-Homework-problem/m-p/791702#M10368</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;I am having trouble with this homework problem. I do not know which procedure to use for this.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the DATA step.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jan 2022 11:07:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Coding-Help-for-Homework-problem/m-p/791702#M10368</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-23T11:07:08Z</dc:date>
    </item>
  </channel>
</rss>

