<?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: way to calculate the porcentage n(x,x) in transpose table in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/way-to-calculate-the-porcentage-n-x-x-in-transpose-table/m-p/79046#M22783</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much Tom.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 09 Jun 2012 00:32:06 GMT</pubDate>
    <dc:creator>michtka</dc:creator>
    <dc:date>2012-06-09T00:32:06Z</dc:date>
    <item>
      <title>way to calculate the porcentage n(x,x) in transpose table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/way-to-calculate-the-porcentage-n-x-x-in-transpose-table/m-p/79044#M22781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi to everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to understand the final code of table 3 to understand the porcentage,&lt;/P&gt;&lt;P&gt;the code use a condition&amp;nbsp; n(_1,t1)=.2 then.... , please check below the right expression,&lt;/P&gt;&lt;P&gt;but I would like to understand this " if condition n(_1,t1)=2 ", why 2?...and how can I found it in the SAS biobiography.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance. V&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you are the code below, please run the code, and I want to understand&amp;nbsp; the if condition n in (data total3), the way to calculate the porcentagey to calculate the:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data new;&lt;/P&gt;&lt;P&gt;input subjid trt fday&amp;nbsp; tday;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp; 1 1 5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp; 1 . 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp; 1 . 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp; 1 1 -4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp; 2 1 5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp; 2 1 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp; 1 1 5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; create table total as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; select count(distinct subjid) as n, trt 'Treatment', 'number of subjects A' as col0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; from new&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where fday ne . &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; group by trt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; proc transpose data=total out=totalt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by col0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; id trt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; var n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; create table total2 as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; select count(distinct subjid) as n, trt 'Treatment', 'number of subjects B' as col0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; from new&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where fday ne . and tday le&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; group by trt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; proc transpose data=total2 out=total2t;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by col0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; id trt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; var n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data total3;&lt;/P&gt;&lt;P&gt; length trt1 trt2 $12;&lt;/P&gt;&lt;P&gt; merge totalt (rename=(_1=t1 _2=t2)) total2t;&lt;/P&gt;&lt;P&gt; if n(_1,t1)=2 then trt1=put(_1,3.)||'&lt;/P&gt;&lt;P&gt;('||put((100*(_1/t1)),5.2)||'%)';&lt;/P&gt;&lt;P&gt; else trt1='&amp;nbsp; 0';&lt;/P&gt;&lt;P&gt; if n(_2,t2)=2 then trt2=put(_2,3.)||'&lt;/P&gt;&lt;P&gt;('||put((100*(_2/t2)),5.2)||'%)';&lt;/P&gt;&lt;P&gt; else trt2='&amp;nbsp; 0';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2012 22:04:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/way-to-calculate-the-porcentage-n-x-x-in-transpose-table/m-p/79044#M22781</guid>
      <dc:creator>michtka</dc:creator>
      <dc:date>2012-06-08T22:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: way to calculate the porcentage n(x,x) in transpose table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/way-to-calculate-the-porcentage-n-x-x-in-transpose-table/m-p/79045#M22782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The N() function counts the number of non missing arguments. So N(_1,t1) is testing that both the _1 and T1 variables are not missing.&lt;/P&gt;&lt;P&gt;It appears to be using this to decide whether to generate count and percentage or just to display a zero.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Jun 2012 00:03:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/way-to-calculate-the-porcentage-n-x-x-in-transpose-table/m-p/79045#M22782</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-06-09T00:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: way to calculate the porcentage n(x,x) in transpose table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/way-to-calculate-the-porcentage-n-x-x-in-transpose-table/m-p/79046#M22783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much Tom.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Jun 2012 00:32:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/way-to-calculate-the-porcentage-n-x-x-in-transpose-table/m-p/79046#M22783</guid>
      <dc:creator>michtka</dc:creator>
      <dc:date>2012-06-09T00:32:06Z</dc:date>
    </item>
  </channel>
</rss>

