<?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: Concomitant therapies at different levels. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concomitant-therapies-at-different-levels/m-p/464999#M118576</link>
    <description>&lt;P&gt;could be something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile='sasc.xls' out=sasc_in dbms=excel replace;
   sheet="foglio1$"; getnames=yes; mixed=yes; scantext=yes;
quit;

proc sql noprint;
   * Denominator: Subject Count in Total;
   select distinct n(distinct pt_id) into :pt_n from sasc_in
   where pt_id is not null;
quit;

%let pt_n=%left(%trim(&amp;amp;pt_n));

proc transpose out=sasc_tr( where=(upcase(_name_) not in('_' 'PT_ID') and col1^=''));
   var _all_; by pt_id;
quit;

data sasc_name;
   set;
   array name[*] $32. therapy level;
   drop i _:;
   do i=1 to dim(name);
      name[i] = scan(_name_, i, '_');
   end;
run;

proc sort; by pt_id therapy level;
quit;

* Level-1 and Level-2 per Patient per Therapy;
data sasc;
   merge sasc_name( in=_l1 where=(upcase(level)='LEVEL1') rename=(col1=level1))
         sasc_name( in=_l2 where=(upcase(level)='LEVEL2') rename=(col1=level2));
   by pt_id therapy;
   drop level;
   * Each Level Combination;
   level_n =1; output;
   * Total;
   level_n =2;
   level1 = "Total";
   level2 = "";
   therapy = ""; output;
run;

proc sort noduprecs; by level_n level1 level2 pt_id therapy;
quit;

* Subject Count per Combination of Levels;
proc freq noprint;
   by level_n level1;
   table level2/out=sasc_freq( drop=percent) sparse;
quit;

* Percentages;
data sasc_pct;
   set;
   n_pct = put(count, 2.)||' ('||put(100*count/&amp;amp;pt_n, 5.1)||'%)';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;just not sure how "simple" you consider it.&lt;/P&gt;</description>
    <pubDate>Fri, 25 May 2018 09:32:56 GMT</pubDate>
    <dc:creator>jim_cai</dc:creator>
    <dc:date>2018-05-25T09:32:56Z</dc:date>
    <item>
      <title>Concomitant therapies at different levels.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concomitant-therapies-at-different-levels/m-p/155498#M30428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In attachment you will find an extract of the input datasets.&lt;/P&gt;&lt;P&gt;I have to summarize data about therapies as in the table below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Level1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Level2&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;N (%)&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Cardiac&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Name1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&amp;nbsp;&amp;nbsp; xx(xx%)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Name2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;xx(xx%)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;...&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;xx(xx%)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;...&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;Total patients&lt;TD style="padding: 2px;"&gt;Total patients&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;xx(100%)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The percentages are to be calculated on the basis of total patient and a patient could have more than one therapy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you suggest a simple method of programming?&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Mar 2014 13:03:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concomitant-therapies-at-different-levels/m-p/155498#M30428</guid>
      <dc:creator>L_L</dc:creator>
      <dc:date>2014-03-25T13:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Concomitant therapies at different levels.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concomitant-therapies-at-different-levels/m-p/464999#M118576</link>
      <description>&lt;P&gt;could be something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile='sasc.xls' out=sasc_in dbms=excel replace;
   sheet="foglio1$"; getnames=yes; mixed=yes; scantext=yes;
quit;

proc sql noprint;
   * Denominator: Subject Count in Total;
   select distinct n(distinct pt_id) into :pt_n from sasc_in
   where pt_id is not null;
quit;

%let pt_n=%left(%trim(&amp;amp;pt_n));

proc transpose out=sasc_tr( where=(upcase(_name_) not in('_' 'PT_ID') and col1^=''));
   var _all_; by pt_id;
quit;

data sasc_name;
   set;
   array name[*] $32. therapy level;
   drop i _:;
   do i=1 to dim(name);
      name[i] = scan(_name_, i, '_');
   end;
run;

proc sort; by pt_id therapy level;
quit;

* Level-1 and Level-2 per Patient per Therapy;
data sasc;
   merge sasc_name( in=_l1 where=(upcase(level)='LEVEL1') rename=(col1=level1))
         sasc_name( in=_l2 where=(upcase(level)='LEVEL2') rename=(col1=level2));
   by pt_id therapy;
   drop level;
   * Each Level Combination;
   level_n =1; output;
   * Total;
   level_n =2;
   level1 = "Total";
   level2 = "";
   therapy = ""; output;
run;

proc sort noduprecs; by level_n level1 level2 pt_id therapy;
quit;

* Subject Count per Combination of Levels;
proc freq noprint;
   by level_n level1;
   table level2/out=sasc_freq( drop=percent) sparse;
quit;

* Percentages;
data sasc_pct;
   set;
   n_pct = put(count, 2.)||' ('||put(100*count/&amp;amp;pt_n, 5.1)||'%)';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;just not sure how "simple" you consider it.&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 09:32:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concomitant-therapies-at-different-levels/m-p/464999#M118576</guid>
      <dc:creator>jim_cai</dc:creator>
      <dc:date>2018-05-25T09:32:56Z</dc:date>
    </item>
  </channel>
</rss>

