Skip to main content

Posts

The power of SAS Proc SGPLOT: Survival Plots

Obtaining the power of SGPLOT using ods output features. In the example below I have placed the y-axis label in top horizontal position using a yaxis statement option in SGPLOT.



The code in my macro is based on the file found on Mantange's SAS blog

Here is a link to my example and macro. The macro is easy to modify.


Recent posts

RF shields: Further investigations

I previously investigated the effect of a metal mesh: Would I be able to construct an RF shield using the principles behind Faraday's cage. The success was limited, there is a loss of field strength, the signal, however, was intact.

Is there another solution? Passive measures are becoming increasingly popular. At the local hardware store, I can buy a one square meter carbon knitted mesh at the price of 23 euro. I assume the cost will double if I cover my walls with the mesh unless I am extremely careful. Better do an overlay than introduce weak spots. Other measures are powder (iron, steel, carbon) glued or painted on surfaces.

A short cut is ventilation pipes. They come in diameters greater than a meter. Up to a diameter of 63 centimeters, you can even buy end pieces in metal.

I performed an experiment with a 10cm diameter ventilation pipe. Most people demonstrate Faraday's cage with a mobile phone, and some people use an AM or FM radio. I prefer to use an attenuated 400MHz t…

COVID19 and the Politik surrounding it

Danish authorities (www.ssi.dk) document the development in cases and deaths, both in the EU/EØS and on a global scale. In the previous weeks, I have seen a risk of death around 4 percent.

Update 27/3-2020: In Italy, we observe a risk of death greater than the risk of death from SARS. I expect a wave of viral spread in Europe from Italy and Spain through France and Germany and exponential growth in number of cases for weeks to come. The novel virus will take its toll the next years in symbiosis with influenza. Hundreds of thousands will die changing the hygiene culture and demanding reform of health services in the Western world. The development in Japan is now worse than a month ago. Japan remains the most successful nation relative to its population size.

Links to monitoring tools and sites:
https://covid19.who.int/

http://shiny.science.ku.dk/pbm/COVID19/

https://www.ssi.dk/sygdomme-beredskab-og-forskning/sygdomsovervaagning/i/influenza-ugens-opgoerelse

http://www.euromomo.eu/

https://co…

Simulation of hemophilia bleeds

A SAS simulation study describing bleeds in hemophilia type A and B patients. Based on the "proof-of-concept study" Randomized, prospective clinical trial of recombinant factor VIIa for secondary prophylaxis in hemophilia patients with inhibitors by Konkle et. al. published in Journal of Thrombosis and Haemostasis, 5: 1904-1913 in 2007.

The epidemiology and design of the study are not in accordance with CONSORT and SPIRIT as of December 2019. We observe 22 included patients (11 in each group) allocated from 20 sites in 11 countries. Neither the randomization nor the analysis is stratified by center, and it is possible to question the logistics of the experiment. People have asked if a condition on the number of bleeds (above 4 for each month in the pre-prophylaxis period) introduces bias: The study is a comparison of the effect of dose-difference not the effect of the drug, although the mean of bleeds in the first period is obviously higher than in the second period. Suspici…

Indicators from numeric factor variables

The macro call below will generate indicators for all factor levels of xfaktor from the data set regdata represented by at least 5 observations. I have developed the macroes to avoid class variables in SAS regression analyses.

%indicator(xfaktor,regdata,5);

/* Macro to generate dummy variables. */
%MACRO GETCON;
  %DO I = 1 %TO &N;
  %IF &&M&I NE 0 %THEN %PUT &factor&I;
  %IF &&M&I = 0 %THEN %GOTO OUT;
    IF &factor = &&M&I THEN &factor&I = 1;
    ELSE &factor&I = 0;
  %OUT: %END;
%MEND GETCON;

%macro indicator(factor,dataset,size);
data tbl_data_;
set &dataset(keep=&factor);
run;
proc sort data=tbl_data_; by &factor; run;
data tbl_;
set tbl_data_;
by &factor;
retain sz;
if first.&factor then sz=1;
else sz=sz+1;
if last.&factor then output;
run;
PROC SORT DATA=tbl_(where=(sz GE &size)) OUT=UNIQUE NODUPKEY;
  BY &factor;
RUN;
/* Assign the largest value of CON to the macro variable N. */
DATA _NULL_;
  SET UNIQUE E…

Graphics in SAS SGPLOT illustrating ANOVA analysis results.

Output and graphics from statistical programming packages are often time-consuming to read and interpret. In peer-reviewed publications you usually provide both a written assessment, tables and graphics illustrating data and analysis results. ANOVA analysis is still a very common analysis technique and it is possible to beautify the output from analysis using PROC SGPLOT

ods graphics;
proc format lib=work;
value timevar
12='0-12 hrs'
18='12-18 hrs'
24='18-24 hrs'
32='Cumulated 0-24 hrs'
;
run;
proc sql;
  create table estimates
    (  Treatment char(12) label='Treatment Group'
     , Time      num      label='Visit number'
     , Time2     num      label='Visit number'
     , TimeVar   char(18) label='Visit number'
     , Mark      char(8)  label='p values'
     , Est       num      label='Est'
     , LCL       num      label='LCL'
     , UCL       num      label='UCL'
    )
  ;
insert into …