SAS macro %progress

From PHUSE Wiki
Revision as of 03:44, 20 September 2019 by Jmbodart (talk | contribs) (Author)
Jump to: navigation, search

Macro %progress - Building Real-Time Feedback in the Data Step

This macro will be presented at the PhUSE EU Connect 2019 conference (Amsterdam).

Motivation

Information will be provided after the presentation.

Minimum reproducible Example

Creating a dummy page dataset

The code below is shared under the MIT license: http://opensource.org/licenses/MIT

*- Create a dataset with one dummy table page for demonstration, indexed by line number (l) -*;
data page(index = (l));
      infile cards truncover;
      input @1 line $char200.;
      l = _n_;
      output;
      put l @8 line $char.;
   cards;
   SPONSOR                                                                                                       CONFIDENTIAL
   INVESTIGATIONAL NEW DRUG / Indication                                                                                Final
   ST0012
                                                           Table 2.1.1    
                                 Demographics and Baseline Characteristics by Period 2 Treatment Group
                                                    Analysis Set: Safety Set 

                                                                      Period 2 Treatment Group
                                             ___________________________________________________________________
                                                          IND 2.5mg Q4H/   IND 4.5mg    IND 2.5mg    IND 2.5mg
                                                          IND 2.5mg Q4H +     Q4H/         Q4H/         Q4H/
                                                          IND 2.5mg Q4H/   IND 4.5mg    IND 2.5mg    IND 4.5mg
                                               PBO/PBO     IND 4.5mg Q8H      Q4H          Q4H          Q8H      All Subjects
    Variable                     Statistic       N=40          N=40           N=49         N=20         N=20         N=169

    Weight (kg)
      Min - 33.3pctile           n (%)        10 (25.0)   16  (40.0)      16  (32.7)    6  (30.0)    6  (30.0)   54  (32.0)
      (39.7 - 64.8)
      >33.3pctile - 66.6pctile   n (%)        30 (75.0)   12  (30.0)      14  (28.6)    6  (30.0)   10  (50.0)   72  (42.6)
      (>64.8 - 74.1)
      >66.6pctile - max          n (%)         0          12  (30.0)      19  (38.8)    8  (40.0)    4  (20.0)   43  (25.4)
      (>74.1 - 123.0)

    Height (cm)                  n               40           40              49           20           20          169
                                 Mean           163.13       167.31          165.74       166.78       167.84       166.30
                                 SD               7.15         6.65            7.40         6.63         6.79         7.07
                                 Median         162.50       167.30          165.50       166.25       168.60       166.30
                                 Min            157.0        155.0           149.2        155.0        155.4        149.2
                                 Max            170.5        186.0           180.6        181.5        186.0        186.0

   _______________________________________________________________________________________________________________________
   BMI=Body Mass Index, BSA=Body Surface Area, IND=Investigational New Drug, IA=Interim Analysis, F=Female, M=Male, 
   Max=Maximum, Min=Minimum, PBO=Placebo, Q4H=Every 4 Hours, Q8H=Every 8 Hours, SD=Standard Deviation, pctile=Percentile.
   Note: Only data assessed during blinded treatment is presented in this table.
   References: Listing 2.1.1, Listing 2.3.1

   Program: t_dm211, 2019-09-01 at 14:24                                                                          Page x of y
;
run;

Expanding to 10,000 pages

*- duplicate the page data 10,000 times by re-reading the page dataset repeatedly -*;
data page10000(drop = start elapsed);
   label p = 'page number' l = "line number";
   put nobs=;
   start = time();
   do p = 1 to 10000; *- loop over the desired number of pages -*;
      elapsed = time()-start;
      if mod(p, 1000) = 0 then put p= elapsed= time12.3;
      do l = 1 to nobs; *- loop over each line of the page -*; 
         set page key = l nobs = nobs; *- the key option allows reading the matching observation using the dataset index -*;
         if l = nobs then substr(line, 105) = put(catx(' ', 'Page', p, 'of', 10000), $20.-r); *- replace "Page x of y" by the actual numbers -*;
         output;
      end;
   end;
   stop;
run;

Processing Problem

Information will be provided after the presentation.

Solution

Information will be provided after the presentation.

Root Cause

Information will be provided after the presentation.

Optimization

Information will be provided after the presentation.

Conclusions

Information will be provided after the presentation.

Author

Jean-Michel Bodart
Business & Decision Life Sciences
Rue Saint-Lambert 141
1200 Brussels
Belgium
http://www.businessdecision-lifesciences.com
--Jmbodart (talk) 10:11, 20 September 2019 (EDT)