<?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: Report table with missing percentage visit*treatment in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/627859#M185428</link>
    <description>&lt;P&gt;Another approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input Id   trt   visit1  visit2  visit3;
	datalines;
1     1      2       3      .
2     1      3       4      .
3     2      .        .       .
4     2      4       .       .
;
run;

/* Missing visits */
proc means data=have noprint;
	var visit1  visit2  visit3;
	class trt;
	ways 1;
	output out=have_miss (drop=_:) nmiss=;
run;

proc transpose data=have_miss out=have_nmiss_tr (rename=(col1=nmiss)) name=visit;
	var visit:;
	by trt;
run;

/* Total visits */
proc means data=have noprint;
	var trt;
	class trt;
	ways 1;
	output out=have_n (drop=_:) n=n /autoname;
run;

/* Merge */
data have_tr;
	merge have_n have_nmiss_tr;
	by trt;
	
	if first.trt then call missing (nmiss_cum, n_cum);
	nmiss_cum + nmiss;
	n_cum + n;
	
	format pct_missing pct_cum_missing percent8.2;
	pct_missing = nmiss/n;
	pct_cum_missing = nmiss_cum / n_cum;
	
	drop n:;
run;

proc sort data=have_tr;
	by visit trt;
run;

proc transpose data=have_tr out=want (drop=_:); /* dataset want: % missing */
	var pct_missing;
	id trt;
	by visit;
run;

proc transpose data=have_tr out=want_cum (drop=_:); /* dataset want_cum: % missing cum */
	var pct_cum_missing;
	id trt;
	by visit;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture d’écran 2020-02-27 à 12.25.44.png" style="width: 169px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36432iD55750BFF468A83A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture d’écran 2020-02-27 à 12.25.44.png" alt="Capture d’écran 2020-02-27 à 12.25.44.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Feb 2020 11:27:32 GMT</pubDate>
    <dc:creator>ed_sas_member</dc:creator>
    <dc:date>2020-02-27T11:27:32Z</dc:date>
    <item>
      <title>Report table with missing percentage visit*treatment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/627833#M185420</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a horizontal repeated measurements data set that looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Id&amp;nbsp;&amp;nbsp; trt&amp;nbsp;&amp;nbsp; visit1&amp;nbsp; visit2&amp;nbsp; visit3&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where trt=treatment.&lt;/P&gt;&lt;P&gt;1) I would like to create a table with % missing percentage for each visit variable by treatment (like the below table):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0" border="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;treatment&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;visit1&lt;/TD&gt;&lt;TD&gt;%missing&lt;/TD&gt;&lt;TD&gt;%missing&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;visit2&lt;/TD&gt;&lt;TD&gt;%missing&lt;/TD&gt;&lt;TD&gt;%missing&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;visit3&lt;/TD&gt;&lt;TD&gt;%missing&lt;/TD&gt;&lt;TD&gt;%missing&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've used&lt;/P&gt;&lt;P&gt;proc means data=want nmiss N;&lt;/P&gt;&lt;P&gt;by trt;&lt;BR /&gt;var visit1 visit2 visit3;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the result is in different treatment tables and there is no missing percentage..&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;2) I would like to create the same table with accumulate % missing percentages towards the last visit by treatment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've also read the attached but with no outcome..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated..&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 10:21:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/627833#M185420</guid>
      <dc:creator>Elma</dc:creator>
      <dc:date>2020-02-27T10:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: Report table with missing percentage visit*treatment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/627854#M185426</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/223405"&gt;@Elma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an approach to do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input Id   trt   visit1  visit2  visit3;
	datalines;
1     1      2       3      .
2     1      3       4      .
3     2      .        .       .
4     2      4       .       .
;
run;

proc sql;
	create table have_stat as
	select trt,
		   nmiss(visit1) / count(trt) as visit1 format=percent8.2,
		   nmiss(visit2) / count(trt) as visit2 format=percent8.2,
		   nmiss(visit3) / count(trt) as visit3 format=percent8.2
	from have
	group by trt;
quit;

proc transpose data=have_stat out=have_tr name=visit;
	var visit:;
	by trt;
run;

proc sort data=have_tr;
	by visit trt;
run;

proc transpose data=have_tr out=want (drop=_:);
	var col1;
	id trt;
	by visit;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output:&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="Capture d’écran 2020-02-27 à 11.55.39.png" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36430i2036E627712E278A/image-size/small?v=v2&amp;amp;px=200" role="button" title="Capture d’écran 2020-02-27 à 11.55.39.png" alt="Capture d’écran 2020-02-27 à 11.55.39.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 10:56:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/627854#M185426</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-27T10:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Report table with missing percentage visit*treatment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/627859#M185428</link>
      <description>&lt;P&gt;Another approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input Id   trt   visit1  visit2  visit3;
	datalines;
1     1      2       3      .
2     1      3       4      .
3     2      .        .       .
4     2      4       .       .
;
run;

/* Missing visits */
proc means data=have noprint;
	var visit1  visit2  visit3;
	class trt;
	ways 1;
	output out=have_miss (drop=_:) nmiss=;
run;

proc transpose data=have_miss out=have_nmiss_tr (rename=(col1=nmiss)) name=visit;
	var visit:;
	by trt;
run;

/* Total visits */
proc means data=have noprint;
	var trt;
	class trt;
	ways 1;
	output out=have_n (drop=_:) n=n /autoname;
run;

/* Merge */
data have_tr;
	merge have_n have_nmiss_tr;
	by trt;
	
	if first.trt then call missing (nmiss_cum, n_cum);
	nmiss_cum + nmiss;
	n_cum + n;
	
	format pct_missing pct_cum_missing percent8.2;
	pct_missing = nmiss/n;
	pct_cum_missing = nmiss_cum / n_cum;
	
	drop n:;
run;

proc sort data=have_tr;
	by visit trt;
run;

proc transpose data=have_tr out=want (drop=_:); /* dataset want: % missing */
	var pct_missing;
	id trt;
	by visit;
run;

proc transpose data=have_tr out=want_cum (drop=_:); /* dataset want_cum: % missing cum */
	var pct_cum_missing;
	id trt;
	by visit;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture d’écran 2020-02-27 à 12.25.44.png" style="width: 169px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36432iD55750BFF468A83A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture d’écran 2020-02-27 à 12.25.44.png" alt="Capture d’écran 2020-02-27 à 12.25.44.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 11:27:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/627859#M185428</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-27T11:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Report table with missing percentage visit*treatment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/627862#M185430</link>
      <description>Thanks a lot!Works great and gives the cumulative %missing.&lt;BR /&gt;&lt;BR /&gt;Is it a way to adjust the code to take the simple (not accumulated)&lt;BR /&gt;%missing?&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Feb 2020 11:35:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/627862#M185430</guid>
      <dc:creator>Elma</dc:creator>
      <dc:date>2020-02-27T11:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Report table with missing percentage visit*treatment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/627864#M185432</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/223405"&gt;@Elma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Awesome&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Normally the %missing (non cumulative) is in the table 'want'.&lt;/P&gt;
&lt;P&gt;The cumulative percentages are in the table 'want_cum'&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 11:39:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/627864#M185432</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-27T11:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Report table with missing percentage visit*treatment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/627895#M185444</link>
      <description>&lt;P&gt;Well, as I have a monotone dataset (once dropout, forever dropout), what I want is the 'Want ' dataset .&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="Untitled.png" style="width: 445px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36437i3D7323248EC39CD9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Untitled.png" alt="Untitled.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;For example if 5% is missing at visit1 and then another 6% at visit2, then in total 11% are missing at visit2, and so on (by treatment).&lt;/P&gt;&lt;P&gt;So everything great until here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to understand what the 'want_cum' includes as percentages &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&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;</description>
      <pubDate>Thu, 27 Feb 2020 13:32:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/627895#M185444</guid>
      <dc:creator>Elma</dc:creator>
      <dc:date>2020-02-27T13:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Report table with missing percentage visit*treatment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/627896#M185445</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/223405"&gt;@Elma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If we take the following example:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; have&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
	&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;Id&lt;/SPAN&gt;   trt   visit1  visit2  visit3&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token datalines"&gt;	&lt;SPAN class="token keyword"&gt;datalines&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token data string"&gt;
1     1      2       3      .
2     1      3       4      .
3     2      .        .       .
4     2      4       .       .&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;-&amp;gt; for trt=2, at visit 1: we have 1 missing visit out of 2 visits (50%). At visit 2, we have 2 missing visits out of 2 visits (100%).&lt;/P&gt;
&lt;P&gt;In a cumulative approach, at visit2, we have 4 visits (2 at visit 1 + 2 at visit 2) and 3 missing values -&amp;gt; 75%. This is what the code computes.&amp;nbsp;Is this kind of approach relevant in your case?&amp;nbsp;Otherwise, which cumulative percentage would be the right value in this case?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 13:39:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/627896#M185445</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-27T13:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: Report table with missing percentage visit*treatment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/628139#M185553</link>
      <description>&lt;P&gt;Yep, my mistake. As "cummulative" I meant the %missing from the derived 'want' table.&lt;/P&gt;&lt;P&gt;So no need for the 'want_cum'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for solving.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 08:11:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/628139#M185553</guid>
      <dc:creator>Elma</dc:creator>
      <dc:date>2020-02-28T08:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Report table with missing percentage visit*treatment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/628148#M185556</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/223405"&gt;@Elma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No worries.&lt;/P&gt;
&lt;P&gt;I am a bit confused about the calculation for cumulative %missing.&lt;/P&gt;
&lt;P&gt;Could you please explain how you want to calculate it from an example?&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 08:39:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/628148#M185556</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-28T08:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: Report table with missing percentage visit*treatment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/629027#M185958</link>
      <description>Well, that was my point in the previous post.&lt;BR /&gt;From the beginning I wanted only one % percent missing: the %missing (from the "want" table): due to the fact that the dataset is monotone, if at visit1 the dropout rate is for example 5%, an added dropout rate of for example 4% at visit2 would yield a total dropout rate of 9% and so on. That was what I meant as "cummulative".&lt;BR /&gt;The second % percent: "want_cum" deriving from the code has no practice.&lt;BR /&gt;&lt;BR /&gt;Many thanks&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Mar 2020 06:25:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-table-with-missing-percentage-visit-treatment/m-p/629027#M185958</guid>
      <dc:creator>Elma</dc:creator>
      <dc:date>2020-03-03T06:25:58Z</dc:date>
    </item>
  </channel>
</rss>

