<?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 perform cmh test and output p value to data set? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-perform-cmh-test-and-output-p-value-to-data-set/m-p/834792#M329995</link>
    <description>Thanks for replying and for the explanation!</description>
    <pubDate>Fri, 23 Sep 2022 03:44:22 GMT</pubDate>
    <dc:creator>Hello_there</dc:creator>
    <dc:date>2022-09-23T03:44:22Z</dc:date>
    <item>
      <title>How to perform cmh test and output p value to data set?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-perform-cmh-test-and-output-p-value-to-data-set/m-p/834771#M329987</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to perform a cmh test with 3 stratification variables: AREA, OBESE, SMOKE.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm performing the individual cmh tests against placebo treatment.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The analysis variable i'm using is IMPROVE, and i'm trying to analyze it by TRT (treatment), according to visit.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data is below, as well as what i think the code should look like.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: This data probably does not make sense because i had to dummy up values.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, other than baseline, it was intentional that there were missing values in IMPROVE. Am I supposed to subset the data so that it doesn't include missing data in the analysis variable?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _have1;
infile datalines dsd dlm=",";
length trt visit $20;
	input subject $ trt $ visit $ area $ obese $ smoke $ improve $;
datalines;
001, active 1, baseline, east, Y, Y,  
001, active 1, day 2, east, Y, Y, Y 
001, active 1, day 3, east, Y, Y,  
001, active 1, day 4, east, Y, Y, Y 
001, active 1, day 5, east, Y, Y, Y 
002, active 2, baseline, west, N, N, 
002, active 2, day 2, west, N, N,
002, active 2, day 3, west, N, N, N
002, active 2, day 4, west, N, N, 
002, active 2, day 5, west, N, N, N
003, placebo, baseline, east, Y, Y, 
003, placebo, day 2, east, Y, Y, Y 
003, placebo, day 3, east, Y, Y,  
003, placebo, day 4, east, Y, Y, Y 
003, placebo, day 5, east, Y, Y, 
004, placebo, baseline, north, Y, Y,
004, placebo, day 2, north, Y, Y, Y
004, placebo, day 3, north, Y, Y, Y
004, placebo, day 4, north, Y, Y, Y
004, placebo, day 5, north, Y, Y, Y
005, active 1, baseline, north, Y, Y, 
005, active 1, day 2, north, Y, Y, Y
005, active 1, day 3, north, Y, Y, Y
005, active 1, day 4, north, Y, Y, N
005, active 1, day 5, north, Y, Y, Y
006, active 2, baseline, west, Y, Y,
006, active 2, day 2, west, Y, Y, N
006, active 2, day 3, west, Y, Y, N
006, active 2, day 4, west, Y, Y, 
006, active 2, day 5, west, Y, Y, N
;
run;

data have1; set _have1;
	* create baseline flag;
	if upcase(visit)="BASELINE" then blfl="Y";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have1;
	by visit;
	table area*obese*smoke*trt*improve/ cmh out=dsnout;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 23:31:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-perform-cmh-test-and-output-p-value-to-data-set/m-p/834771#M329987</guid>
      <dc:creator>Hello_there</dc:creator>
      <dc:date>2022-09-22T23:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform cmh test and output p value to data set?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-perform-cmh-test-and-output-p-value-to-data-set/m-p/834774#M329988</link>
      <description>&lt;P&gt;First a bit about coding style for an example.&lt;/P&gt;
&lt;P&gt;Just include the additional program statements in the first data step, no need to create a second data set (for this example anyway). Or don't bother as you aren't showing any use of the blfl variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have1;
   infile datalines dsd dlm=",";
   length trt visit $20;&lt;BR /&gt;   input subject $ trt $ visit $ area $ obese $ smoke $ improve $;
   if upcase(visit)="BASELINE" then blfl="Y";
datalines;&lt;/PRE&gt;
&lt;P&gt;Second to use BY Visit in the Proc freq you either have to sort the data by the Visit variable OR use the "notsorted" option on the BY statement. Otherwise you get this in the log and incomplete output.&lt;/P&gt;
&lt;PRE&gt;ERROR: Data set WORK.HAVE1 is not sorted in ascending sequence. The current BY group has visit =
       day 5 and the next BY group has visit = baseline.

&lt;/PRE&gt;
&lt;P&gt;You also are getting messages like this for multiple levels of Visit.&lt;/P&gt;
&lt;PRE&gt;NOTE: No statistics are computed for trt * improve because all data are missing.
NOTE: The above message was for the following BY group:
      visit=baseline
&lt;/PRE&gt;
&lt;P&gt;This is also related to the failure to sort because your data is using &lt;STRONG&gt;only&lt;/STRONG&gt; the &lt;STRONG&gt;first&lt;/STRONG&gt; record where visit=&amp;lt;some value&amp;gt; and there is only one set of values for Trt and Improve. So not enough data to do a CMH test.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By default missing values will be excluded from the analysis. IF you want to see analysis including missing values then you can include the option MISSING on the Tables statement. That will treat the missing values as a valid level of all variables on the Tables statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which you should use depends on the actual analysis you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 00:22:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-perform-cmh-test-and-output-p-value-to-data-set/m-p/834774#M329988</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-09-23T00:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform cmh test and output p value to data set?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-perform-cmh-test-and-output-p-value-to-data-set/m-p/834792#M329995</link>
      <description>Thanks for replying and for the explanation!</description>
      <pubDate>Fri, 23 Sep 2022 03:44:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-perform-cmh-test-and-output-p-value-to-data-set/m-p/834792#M329995</guid>
      <dc:creator>Hello_there</dc:creator>
      <dc:date>2022-09-23T03:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform cmh test and output p value to data set?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-perform-cmh-test-and-output-p-value-to-data-set/m-p/834825#M330015</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=sashelp.heart ;
table bp_status*status*sex/cmh ;
output out=want cmh;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Sep 2022 11:56:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-perform-cmh-test-and-output-p-value-to-data-set/m-p/834825#M330015</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-09-23T11:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform cmh test and output p value to data set?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-perform-cmh-test-and-output-p-value-to-data-set/m-p/834867#M330028</link>
      <description>thanks this was helpful!</description>
      <pubDate>Fri, 23 Sep 2022 15:58:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-perform-cmh-test-and-output-p-value-to-data-set/m-p/834867#M330028</guid>
      <dc:creator>Hello_there</dc:creator>
      <dc:date>2022-09-23T15:58:46Z</dc:date>
    </item>
  </channel>
</rss>

