Recently in the SAS Community Library: SAS' @StuartRogers provides a close look at the new Microsoft Entra Gallery application and details how it can be used.
Hi SAS Community,
I've been trying to create a grouped forest plot in SAS, but so far, I've only been able to find resources on how to create a single forest plot. However, my requirement is to combine two forest plots into one, similar to the attached sample plot.
I'm wondering if anyone could offer some guidance on how to achieve this. Should I use proc sgplot or proc template for this purpose? Currently, I'm using the proc sgplot code provided in this post: CTSPedia Clinical Graphs - Subgrouped Forest Plot.
Any insights or examples you could share would be greatly appreciated!
Thank you in advance!
Jess
... View more
The fact that I even have to post this tells u what kind of day I'm having 😞 If the HLT_ALZDEM variable doesn't have a valid value of 1 or 2 (yes/no), then the variables that are constructed based on HLT_ALZDEM should be given a value of missing. However, they sometimes are given a value of 0 instead.
Below is a portion of the output file, sorted for rows where HLT_ALZDEM is missing. Since missing is clearly not 1 or 2, all ADRD_group and non_ADRD_group values should also be missing. But they're not. Obs 9 and 10 are identical except for these 2 variables., when Obs 9 is missing and Obs 10 is 0 for both.
The only possible explanation I can think of is that there are non-printable characters for some values of HLT_ALZDEM. But even if there are, those non-printable characters are not 1 or 2. Frequencies for HLT_ALZDEM only show values of 1, 2, and missing.
IF cohort_flag = 1 AND ADM_MA_FLAG_YR = 3
THEN MA_group = 1; ELSE MA_group = 0;
IF cohort_flag = 0 THEN MA_group = .;
IF cohort_flag = 1 AND ADM_FFS_FLAG_YR = 3
THEN TM_group = 1; ELSE TM_group = 0;
IF cohort_flag = 0 THEN TM_group = .;
IF cohort_flag = 1 AND HLT_ALZDEM = 1
THEN ADRD_group = 1; ELSE ADRD_group = 0;
IF cohort_flag = 0 THEN ADRD_group = .;
IF HLT_ALZDEM ^in (1,2) THEN ADRD_group = .;
IF cohort_flag = 1 AND HLT_ALZDEM = 2
THEN non_ADRD_group = 1; ELSE non_ADRD_group = 0;
IF cohort_flag = 0 THEN non_ADRD_group = .;
IF HLT_ALZDEM ^in (1,2) THEN non_ADRD_group = .;
Obs
HLT_ALZDEM
cohort_flag
MA_group
TM_group
ADRD_group
non_ADRD_group
1
0
2
1
0
1
0
0
3
1
1
0
4
0
5
0
6
1
0
1
7
1
1
0
8
1
1
0
9
1
1
0
10
1
1
0
0
0
11
1
1
0
12
1
0
1
13
1
0
1
14
1
0
1
15
1
0
1
16
1
0
1
0
0
... View more
Hi I am new to proc template . 1. I am displaying bar value at the top of bar using barlabel=true. How to display the value at the center of the bar instead of top? 2. Also, how to wrap x axis value. text variable have one value very long 3. what option in proc template i can use to display P value at the top. Thanks in advance
... View more
I need suggestions on how to widen my dataset. I need a single line for each ID while keeping all the data in the sample dataset. I plan on later merging this with another dataset by ID. I was unable to transpose the data because an ID can have multiple same_spans of the same number (see ID R in the data example).
Thanks!
Data Have;
input
ID$ Clinic$ Span_Beg :Date9. Span_End :Date9. Same_Span ;
format Span_Beg MMDDYY10. Span_End MMDDYY10.;
datalines;
A Clinic1 17Nov2022 4Jan2023 1
B Clinic2 1Jul2022 29Jul2022 1
B Clinic2 21Nov2022 4Apr2023 2
C Clinic1 1Jul2022 7Jul2022 1
D Clinic3 1Jul2022 12Jul2022 1
E Clinic1 22Nov2022 19Mar2023 1
F Clinic2 26Aug2022 15May2023 1
G Clinic4 1Oct2022 10Apr2023 1
H Clinic5 30Dec2022 19Jan2023 1
I Clinic6 1Jul2022 1Nov2022 1
I Clinic6 11Nov2022 10Jan2023 2
I Clinic6 1Feb2023 30Apr2023 3
J Clinic2 1Jul2022 21Aug2022 1
K Clinic2 9Mar2023 30Jun2023 1
L Clinic5 20Sep2022 20Feb2023 1
M Clinic5 1Jul2022 2Aug2022 1
N Clinic1 6Jul2022 1Sep2022 1
O Clinic7 1Jul2022 1Sep2022 1
P Clinic8 1Jul2022 24Oct2022 1
Q Clinic8 1Jul2022 4Dec2022 1
R Clinic9 19Dec2022 31May2023 1
R Clinic9 8Jun2023 18Jun2023 2
R Clinic1 28Aug2022 18Sep2022 1
S Clinic1 1Jul2022 10Jul2022 1
S Clinic3 4Aug2022 17Nov2022 1
;
run;
... View more