<?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: How to export HR (95% CI) from Proc Phreg Macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/742699#M232368</link>
    <description>&lt;P&gt;I tried your syntax, adding it in the data set before running all - wonder if this is correct but results came out the same with last value as reference not the first one. Do we need to adjust anything in 'data _NULL'?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 20 May 2021 16:27:05 GMT</pubDate>
    <dc:creator>haoduonge</dc:creator>
    <dc:date>2021-05-20T16:27:05Z</dc:date>
    <item>
      <title>How to export HR (95% CI) from Proc Phreg Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/666375#M199367</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wrote a simple macro for Proc Phreg function below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to export the HR (95% C.I.) for all variables in one Excel file.&amp;nbsp;Could anyone please help me with the code? Thank you all in advance.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro HR(x=);&lt;BR /&gt;proc phreg data = CP1;&lt;BR /&gt;class &amp;amp;x;&lt;BR /&gt;model Time*Event(0) = &amp;amp;x /rl;&lt;BR /&gt;run;&lt;BR /&gt;%mend HR;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%HR(x=Gender);&lt;BR /&gt;%HR(x=Disease_Type);&lt;BR /&gt;%HR(x=Disease_Status);&lt;BR /&gt;%HR(x=Active_Therapy);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 17:12:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/666375#M199367</guid>
      <dc:creator>Denali</dc:creator>
      <dc:date>2020-07-01T17:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to export HR (95% CI) from Proc Phreg Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/666574#M199462</link>
      <description>&lt;P&gt;Hi, use ODS Output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;libname out xlsx "C:\want.xlsx";
%macro HR(x=);
   %let outputName=_PE%substr(%cmpres(&amp;amp;x.),1,%sysfunc(min(%length(&amp;amp;x.),29)));
   ods graphics off;
   ods output ParameterEstimates=&amp;amp;outputName.;

   proc phreg data = CP1;
      class &amp;amp;x;
      model Time*Event(0) = &amp;amp;x /rl;
   run;

   ods output close;
   ods graphics on;

   data out.&amp;amp;outputName.;
   set &amp;amp;outputName.;
   run;
%mend HR;

%HR(x=Gender);
%HR(x=Disease_Type);
%HR(x=Disease_Status);
%HR(x=Active_Therapy);&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Jul 2020 10:21:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/666574#M199462</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2020-07-02T10:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to export HR (95% CI) from Proc Phreg Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/666593#M199474</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/77163"&gt;@Oligolas&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much for the code! Could we optimize it and put all the HR(95%CI) in one single tab in the Excel? Maybe "append"&amp;nbsp; all the HR(95% CI)? At the moment, the code exported all the HRs and 95% CIs into seperate tabs by outcome (gender, active therapy).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2020 14:42:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/666593#M199474</guid>
      <dc:creator>Denali</dc:creator>
      <dc:date>2020-07-02T14:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to export HR (95% CI) from Proc Phreg Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/666787#M199567</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I see, try this:&lt;/P&gt;
&lt;PRE&gt;libname out xlsx "C:\want.xlsx";
%macro HR(x=);
   %let outputName=_PE%substr(%cmpres(&amp;amp;x.),1,%sysfunc(min(%length(&amp;amp;x.),29)));
   ods graphics off;
   ods output ParameterEstimates=&amp;amp;outputName.;

   proc phreg data = CP1;
      class &amp;amp;x;
      model Time*Event(0) = &amp;amp;x /rl;
   run;

   ods output close;
   ods graphics on;

%mend HR;

%HR(x=Gender);
%HR(x=Disease_Type);
%HR(x=Disease_Status);
%HR(x=Active_Therapy);


/**Ensure uniform variable length prior setting datasets**/
*Determine max variable lengths from metadata;
PROC SQL;
   CREATE TABLE temp AS
   SELECT DISTINCT * FROM
   (
      SELECT DISTINCT name,type,max(length) as length,varnum
      FROM sashelp.vcolumn
      WHERE LIBNAME eq 'WORK' and substr(memname,1,3) eq '_PE'
      GROUP BY name,type
   )
   ORDER BY varnum
   ;
QUIT;

*Generate attrib statement content. Uniform variable length - ensure no data is cut off;
DATA _NULL_;
   LENGTH attrib $ 2000;
   SET temp end=last;
   BY varnum;
   RETAIN attrib '';
   IF _N_ eq 1 THEN call missing(attrib);
   attrib=strip(attrib)||' '||strip(name);
   IF type eq 'char' THEN attrib=strip(attrib)||' length=$'||strip(put(length,best8.));
   ELSE attrib=strip(attrib)||' length='||strip(put(length,best8.));
   IF last THEN call symputx('gblattrib',attrib);
RUN;
%put &amp;amp;=gblattrib.;

*output data;
DATA out.ParameterEstimates;
   ATTRIB &amp;amp;gblattrib.;
   SET _PE:;
RUN;

*Clean up;
%SYMDEL gblattrib;
PROC DATASETS lib=work nolist; delete _PE: temp ParameterEstimates; RUN;QUIT;
libname out clear;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jul 2020 11:39:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/666787#M199567</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2020-07-03T11:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to export HR (95% CI) from Proc Phreg Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/666939#M199644</link>
      <description>Bravo! It worked! THANK YOU SO MUCH!!!</description>
      <pubDate>Sat, 04 Jul 2020 13:00:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/666939#M199644</guid>
      <dc:creator>Denali</dc:creator>
      <dc:date>2020-07-04T13:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to export HR (95% CI) from Proc Phreg Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/742464#M232264</link>
      <description>&lt;P&gt;Hi, Thank you so much for the code, saving quite some time!&lt;/P&gt;&lt;P&gt;However, when I use the option for reference group:&lt;/P&gt;&lt;P&gt;class &amp;amp;x (ref='first') - it shows error, I really appreciate if you could show where to change in the code lines for it.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Hao&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 16:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/742464#M232264</guid>
      <dc:creator>haoduonge</dc:creator>
      <dc:date>2021-05-19T16:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to export HR (95% CI) from Proc Phreg Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/742617#M232339</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;well, I suspect you do not have a value of &amp;amp;x='first' in each of your &amp;amp;x variables.&lt;/P&gt;
&lt;P&gt;You may need to determine the reference value for each of your variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I added such a dummy 'first' value in each of the variables in my test data and it worked, please find an example below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cp1;
   set sashelp.class;
   length Gender $5 Disease_Type $5 Disease_Status $8 Active_Therapy $5 Time 8 Event 8;
   Gender=sex;
   Disease_Type=ifc(sex eq 'M','One','Two');
   Disease_Status=ifc(sex eq 'M','Resolved','Ongoing');
   Active_Therapy=ifc(sex eq 'M','Y','N');
   Time=age;
   Event=mod(age,2);

   *add a reference to all variables;
   array vars _CHARACTER_;
   do over vars;
      if mod(_N_,3) eq 0 then vars='first';
   end;
   keep Gender Disease_Type Disease_Status Active_Therapy Time Event;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 May 2021 09:34:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/742617#M232339</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2021-05-20T09:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to export HR (95% CI) from Proc Phreg Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/742699#M232368</link>
      <description>&lt;P&gt;I tried your syntax, adding it in the data set before running all - wonder if this is correct but results came out the same with last value as reference not the first one. Do we need to adjust anything in 'data _NULL'?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 20 May 2021 16:27:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/742699#M232368</guid>
      <dc:creator>haoduonge</dc:creator>
      <dc:date>2021-05-20T16:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to export HR (95% CI) from Proc Phreg Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/742836#M232444</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you need to check for each of your variable what the reference should be. I added it for example purposes only. Consult a statistician to determine the reference.&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 07:18:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/742836#M232444</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2021-05-21T07:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to export HR (95% CI) from Proc Phreg Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/742896#M232474</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 13:38:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/742896#M232474</guid>
      <dc:creator>haoduonge</dc:creator>
      <dc:date>2021-05-21T13:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to export HR (95% CI) from Proc Phreg Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/747144#M234452</link>
      <description>&lt;P&gt;Hi Oligolas,&lt;/P&gt;&lt;P&gt;I know this topic was solved but my question is relevant to it, so I ask it here.&lt;/P&gt;&lt;P&gt;Your codes work great for proc&amp;nbsp;phreg with time invarying covariates.&lt;/P&gt;&lt;P&gt;Can you help with codes for modeling multiple time varying covariates as below?&lt;/P&gt;&lt;P&gt;I have about 15 sets of variables (X, Y....) so it would be great not to repeat them 15 times.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&lt;SPAN&gt;proc&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;phreg&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;data&lt;/SPAN&gt;&lt;SPAN&gt;=table1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;SPAN&gt;model&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;TIME*outcome (&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/ST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bsp;tt[i] &amp;lt;= TIME &amp;lt; tt[i+&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;]&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;then&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;X= pp[i];&lt;/SPAN&gt;&lt;SPAN&gt;end&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&lt;STRONG&gt;&lt;SPAN&gt;run&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jun 2021 17:00:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/747144#M234452</guid>
      <dc:creator>haoduonge</dc:creator>
      <dc:date>2021-06-10T17:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to export HR (95% CI) from Proc Phreg Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/747294#M234522</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;not sure I understood you properly, you mean, you'd like to do the same proc phreg for the variable Y and so on like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc phreg data=table1;
   model TIME*outcome (0)=Y/TIES = EFRON RL;
   array pp{*} Y1-Y5;
   array tt{*} t1-t6;   t1=1;  t2=2;  t3=3;  t4=4;  t5=5;   t6=6; 
   if TIME &amp;lt;tt[1]       then Y=Y0; 
   else if TIME &amp;gt;= tt[6] then Y=Y6;
   else do i=1 to dim(pp); if tt[i] &amp;lt;= TIME &amp;lt; tt[i+1] then Y= pp[i];end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;if yes then you only need to loop over the variables that you need:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO loop(varlist=x y z);
   %local varlist i currItem;
   %LET i=1;
   %LET currItem=%SCAN(&amp;amp;varlist.,&amp;amp;i.,%STR( ));
   %DO %WHILE(%LENGTH(&amp;amp;currItem.)&amp;gt;0);


      proc phreg data=table1;
         model TIME*outcome (0)=&amp;amp;currItem./TIES = EFRON RL;

         array pp{*} &amp;amp;currItem.1-&amp;amp;currItem.5;
         array tt{*} t1-t6;   t1=1;  t2=2;  t3=3;  t4=4;  t5=5;   t6=6; 
         if TIME &amp;lt;tt[1]       then &amp;amp;currItem.=&amp;amp;currItem.0; 
         else if TIME &amp;gt;= tt[6] then &amp;amp;currItem.=&amp;amp;currItem.6;
         else do i=1 to dim(pp); if tt[i] &amp;lt;= TIME &amp;lt; tt[i+1] then &amp;amp;currItem.= pp[i];end;
      run;

      %put &amp;amp;=varlist &amp;amp;=i &amp;amp;=currItem;
      %LET i=%EVAL(&amp;amp;i.+1);
      %LET currItem=%SCAN(&amp;amp;varlist.,&amp;amp;i.,%STR( ));
   %END;
%MEND loop;
%loop(varlist=X Y Z);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Jun 2021 09:15:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/747294#M234522</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2021-06-11T09:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to export HR (95% CI) from Proc Phreg Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/747353#M234551</link>
      <description>&lt;P&gt;Yes, wonderful!&lt;/P&gt;&lt;P&gt;Thanks so much!&lt;/P&gt;&lt;P&gt;Hao&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 14:21:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/747353#M234551</guid>
      <dc:creator>haoduonge</dc:creator>
      <dc:date>2021-06-11T14:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to export HR (95% CI) from Proc Phreg Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/789924#M252857</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wen_23_0-1642065744413.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67365i266DDF32B586882A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Wen_23_0-1642065744413.png" alt="Wen_23_0-1642065744413.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;ods output ParameterEstimates= Est;&lt;BR /&gt;proc phreg data=have;&lt;BR /&gt;model AVAL*y(1)=sexn AGEGR1N/ALPHA=0.05 rl;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hi , try the option -- ALPHA=0.05 rl&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 09:23:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/789924#M252857</guid>
      <dc:creator>blueskyxyz</dc:creator>
      <dc:date>2022-01-13T09:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to export HR (95% CI) from Proc Phreg Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/789925#M252858</link>
      <description>&lt;A href="https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_phreg_sect016.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_phreg_sect016.htm&lt;/A&gt;</description>
      <pubDate>Thu, 13 Jan 2022 09:24:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-export-HR-95-CI-from-Proc-Phreg-Macro/m-p/789925#M252858</guid>
      <dc:creator>blueskyxyz</dc:creator>
      <dc:date>2022-01-13T09:24:21Z</dc:date>
    </item>
  </channel>
</rss>

