<?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: Storing the P value and Hazard ratios from multiple Proc PHREG to a Dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Storing-the-P-value-and-Hazard-ratios-from-multiple-Proc-PHREG/m-p/741176#M231660</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/362226"&gt;@fikel&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would insert this statement before the PROC PHREG step in the macro:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods output ParameterEstimates=estim&amp;amp;i(where=(parameter="&amp;amp;dichotvar"));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will create datasets ESTIM1, ESTIM2, ... (for &lt;FONT face="courier new,courier"&gt;&amp;amp;i=1&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;2&lt;/FONT&gt;, ...) containing the parameter estimates, p-values and hazard ratios. (The dataset names "ESTIM1" etc. are user-defined.) The WHERE= dataset option is optional, but may be useful to focus on the parameter whose cutoff is under investigation. You can also add a KEEP= or DROP= dataset option to restrict the datasets to variables of interest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These ESTIM&lt;EM&gt;n&lt;/EM&gt; datasets can be combined to a single dataset for all iterations (e.g., for one parameter)&lt;FONT face="helvetica"&gt;:&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data est;
/* insert a suitable LENGTH statement here if warning "Multiple lengths ..." occurs */
set estim: indsname=dsn;
iteration=input(compress(dsn,,'kd'),32.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Instead of the shortcut &lt;FONT face="courier new,courier"&gt;estim:&lt;/FONT&gt;&amp;nbsp;in the SET statement you can use a more explicit list of the form &lt;FONT face="courier new,courier"&gt;estim1-estim99&lt;/FONT&gt;&amp;nbsp;(which also might improve the sort order). You may want to add a variable CUTOFF to dataset EST (or the individual ESTIM&lt;EM&gt;n&lt;/EM&gt;) in order to bring cutoff and p-values together.&lt;/P&gt;</description>
    <pubDate>Thu, 13 May 2021 16:56:02 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2021-05-13T16:56:02Z</dc:date>
    <item>
      <title>Storing the P value and Hazard ratios from multiple Proc PHREG to a Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Storing-the-P-value-and-Hazard-ratios-from-multiple-Proc-PHREG/m-p/741112#M231637</link>
      <description>&lt;P&gt;Hello, I have a dataset where my exposure of interest is the level of a particular nutrient and the outcome is cancer. I wanted to find the level of nutrient at which splitting the cohort at that point had the lowest (most significant) p-value. An example of the interpretation of this level would be: people who consume more than 100 units of this nutrient have a 20% lower risk of cancer with a p-value of 0.003.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a macro to basically split the cohort at a specific level of the nutrient and run Proc PHREG to give me the hazard ratio's and associated P-values comparing the individuals with intake above the cutpoint to individuals below the cutpoint. I wrote a data step to run this macro at multiple different nutrient levels. I am still very new at SAS and was hoping to find out if there was a way to store the p-values and hazard ratios from the multiple Proc PHREG procedures, so I can use a data step to find the minimum P-value or even plot the p-values by the cutpoints.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the macro:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro dichotomize(dsn,var,cutoff,i,dichotvar);
%LET iteration = &amp;amp;i;

		data want&amp;amp;iteration;
		set want_someday;
		
		       if &amp;amp;var =. then &amp;amp;dichotvar = .;
		  else if &amp;amp;var le &amp;amp;cutoff then &amp;amp;dichotvar=0;
		  else if &amp;amp;var gt &amp;amp;cutoff then &amp;amp;dichotvar=1;
		run;
		
		proc phreg data = want&amp;amp;iteration;
		title "Colorectal-cancer incidence attempt";
		
		class &amp;amp;dichotvar (ref="0") menopause_with_males (ref="0") race (ref="1") hhincome (ref="1")
				enrollment_source (ref="C") fh_colorectalcancer (ref="0")
				BMI_category_expanded (ref="0") alcohol_category (ref="0") smokestatus_packyear (ref="0") hei10_category (ref="0")
				; 
		model eof_age_CRC*Inc_CRC(0) = &amp;amp;dichotvar 
				menopause_with_males race hhincome enrollment_source 
				BMI_category_expanded totalactivitymethr smokestatus_packyear Comorbidity_Index 
				ffq_kcal hei10_category alcohol_category fh_colorectalcancer
				/ entry=enrollment_agemonths rl=wald;
		run;	
		
%mend dichotomize;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 13:46:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Storing-the-P-value-and-Hazard-ratios-from-multiple-Proc-PHREG/m-p/741112#M231637</guid>
      <dc:creator>fikel</dc:creator>
      <dc:date>2021-05-13T13:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: Storing the P value and Hazard ratios from multiple Proc PHREG to a Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Storing-the-P-value-and-Hazard-ratios-from-multiple-Proc-PHREG/m-p/741176#M231660</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/362226"&gt;@fikel&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would insert this statement before the PROC PHREG step in the macro:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods output ParameterEstimates=estim&amp;amp;i(where=(parameter="&amp;amp;dichotvar"));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will create datasets ESTIM1, ESTIM2, ... (for &lt;FONT face="courier new,courier"&gt;&amp;amp;i=1&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;2&lt;/FONT&gt;, ...) containing the parameter estimates, p-values and hazard ratios. (The dataset names "ESTIM1" etc. are user-defined.) The WHERE= dataset option is optional, but may be useful to focus on the parameter whose cutoff is under investigation. You can also add a KEEP= or DROP= dataset option to restrict the datasets to variables of interest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These ESTIM&lt;EM&gt;n&lt;/EM&gt; datasets can be combined to a single dataset for all iterations (e.g., for one parameter)&lt;FONT face="helvetica"&gt;:&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data est;
/* insert a suitable LENGTH statement here if warning "Multiple lengths ..." occurs */
set estim: indsname=dsn;
iteration=input(compress(dsn,,'kd'),32.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Instead of the shortcut &lt;FONT face="courier new,courier"&gt;estim:&lt;/FONT&gt;&amp;nbsp;in the SET statement you can use a more explicit list of the form &lt;FONT face="courier new,courier"&gt;estim1-estim99&lt;/FONT&gt;&amp;nbsp;(which also might improve the sort order). You may want to add a variable CUTOFF to dataset EST (or the individual ESTIM&lt;EM&gt;n&lt;/EM&gt;) in order to bring cutoff and p-values together.&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 16:56:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Storing-the-P-value-and-Hazard-ratios-from-multiple-Proc-PHREG/m-p/741176#M231660</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-05-13T16:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Storing the P value and Hazard ratios from multiple Proc PHREG to a Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Storing-the-P-value-and-Hazard-ratios-from-multiple-Proc-PHREG/m-p/741256#M231690</link>
      <description>&lt;P&gt;Thank you so much! This successfully created the dataset. In regard to adding a CUTOFF variable to the EST or ESTIM&lt;EM&gt;n&lt;/EM&gt;, I am having a difficult time getting this added to the ESTIMn data sets. How do I accomplish this?&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 19:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Storing-the-P-value-and-Hazard-ratios-from-multiple-Proc-PHREG/m-p/741256#M231690</guid>
      <dc:creator>fikel</dc:creator>
      <dc:date>2021-05-13T19:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Storing the P value and Hazard ratios from multiple Proc PHREG to a Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Storing-the-P-value-and-Hazard-ratios-from-multiple-Proc-PHREG/m-p/741278#M231703</link>
      <description>&lt;P&gt;There are different ways to do this. One is to insert a DATA step into the macro, after the PROC PHREG step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  data estim&amp;amp;i;
  set estim&amp;amp;i;
  cutoff=&amp;amp;cutoff;
  run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 21:02:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Storing-the-P-value-and-Hazard-ratios-from-multiple-Proc-PHREG/m-p/741278#M231703</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-05-13T21:02:07Z</dc:date>
    </item>
  </channel>
</rss>

