SGPLOTでForest plot

135 Views

April 03, 24

スライド概要

[第5回大阪sas勉強会]三木悠吾

profile-image

SAS言語を中心として,解析業務担当者・プログラマなのコミュニティを活性化したいです

シェア

またはPlayer版

埋め込む »CMSなどでJSが使えない場合

関連スライド

各ページのテキスト
1.

SGPLOTで Forest plot highlowを使ってみた FMD K&L Japan Yugo Miki

2.

Introduction • ボロボロな試験の対応と度重なる照会事項処理のため、深刻なネタ不足 • Creativityの低下 • 久しぶりにForest Plot作成(プログラム作成は癒し) • O社内にhighlowで書いたプログラムがないなー • 折角だからhighlowで書こうか ゴールはこんなの→

3.

Introduction - highlow statement • 開始点と終了点の間に線を引くようなグラフが得意 • Swimmer plotが有名 • 一行の中で色分けしたいときなどにも対応することができる (BAR系のplotよりも柔軟)

4.

Drafting • とりあえず書いてみた proc sgplot data = disp noautolegend ; highlow y = sort2 high = hr_high low = hr_low; format sort2 paramf.; run; <Syntax> HIGHLOW X=variable | Y=variable HIGH=numeric-variable LOW=numeric-variable </option(s)>; しょぼいの出来た!→

5.

考察① 順序が逆。 →Yaxisで調整 軸ラベルでカテゴリ表 示は柔軟性に欠ける →YAXISTABLEへ変更 Hazard比はどうやって 出力する? →ScatterやBubbleを overlay カテゴリ間にスペース 入れたい →データ加工する

6.

Modify 1 • 流し込むデータを変更する ダミー行を追加 proc sgplot data = disp noautolegend ; highlow y = sort high = hr_high low = hr_low; yaxis display = none reverse; run; ダミー行のところがいい感じ に抜けている

7.

Modify 2 • Axis tableを追加、ついでにインデントも作る proc sgplot data = disp noautolegend; highlow y = sort high = hr_high low = hr_low; yaxis display = none reverse; yaxistable rawhead / label = "Subgroup" position = left indentweight = indent; run;

8.

Modify 3 • 端にバーを追加、バブルをoverlay proc sgplot data = disp noautolegend; highlow y = sort high = hr_high low = hr_low / lowcap = serif highcap = serif ; bubble y = sort x = hr size = n1 / bradiusmax = 4.2 bradiusmin = 0.2 fillattrs= (color=black); yaxis display = none reverse; yaxistable…;

9.

Note 1 • Highlowの矢印部分の指定 • Lowcap/Highcap = none/serif/barbedarrow/filledarrow/openarrow/closearrow

10.

Modify 4 • 参照線、カテゴリごとに色を追加 proc sgplot data = disp noautolegend; refline ref / axis = y … highlow … bubble … yaxis display = none reverse; yaxistable…; refline 1 / axis = x … run;

11.

Modify 5 • まあ、完成かな proc sgplot data = disp noautolegend nowall; refline color / axis = y lineattrs =(thickness=40 color =cxf0f0f0); highlow y = sort high = hr_high low = hr_low / lowcap = serif highcap = serif; bubble y = sort x = hr size = n1n / bradiusmax = 4.2 bradiusmin = 0.2 fillattrs= (color=black); xaxis label = "Hazard Radio" values = (0 0.5 1.0 1.5 2.0 2.5); yaxis display = none reverse colorbands=odd; yaxistable rawhead / location=inside position = left indentweight = indent; yaxistable ev1 ev2 hazard1 / location=inside position = left ; label rawhead = "Subgroup" ev1 = "Number of Event (Subject) in DrugA" ev2 = "Number of Event (Subject) in DrugB" hazard1 = 'Hazard Ratio [95% CI]' ; refline 1 / axis = x lineattrs =(pattern=shortdash) transparency=0.5; run;

12.

使用したデータセット • Rawhead:ラベル表示用 • Ev1,2,hazard1:結果表示用 • Indent:axis tableのインデント用変数 • Color:背景色指定時の行を指定 • N1n:Bubble plotのサイズ(weight)を指定

13.

Reference • https://www.sas.com/content/dam/SAS/ja_jp/doc/event/sasuser-groups/usergroups2016-d-10.pdf • https://documentation.sas.com/?docsetId=grstatproc&docsetTar get=n0mjz9ktgnse58n14deqdvnnxarp.htm&docsetVersion=9.4&l ocale=en