Hello programmers,
I am trying to use proc report to replicated the format of the data in the picture.
Is there a way to combine 'Baseline Mean" and "Baseline Std" in the same column like in the form that i want it to? Same thing with "Month mean" and "Month std"
My data set and code is attached. Any form of help is needed.
data AAA;
input grporder grpname $ Tc Tn $ Mean_baseline Mean_12_months std_baseline std_12_months prob_change run;
datalines;
1 Motor 2 UHDRS 32.8571 29.7143 6.2029 7.5435 0.29688 1
1 Motor 3 CHOREA 11.8571 10.1429 3.7607 1.8645 0.15625 1
1 Motor 4 GAIT 1.2857 1.2857 0.488 0.7559 1 1
1 Motor 5 TANDEM 1.8571 1.5714 1.069 1.3973 0.75 1
1 Motor 6 PULL 0.1429 0.7143 0.378 0.7559 0.125 1
1 Motor 7 BALANCE 3.2857 3.5714 1.3801 2.6367 1 1
2 Physical 1 TFC 6.5714 7 0.9759 2.1602 0.625 1
2 Physical 13 FA 20.2857 19.1429 2.2147 3.2367 0.3125 1
2 Physical 14 IS 77.1429 71.4286 8.5912 7.4801 0.28125 1
3 Cognigt 8 COWA 27.1667 31.5 8.2321 13.896 0.1875 1
3 Cognigt 9 SYMBAL 25.1429 20.1429 5.113 7.1514 0.09375 1
3 Cognigt 10 STRP1 45.8571 38.2857 13.5576 17.1437 0.04688 1
3 Cognigt 11 STRP2 61.7143 52.2857 19.414 22.5367 0.03125 1
3 Cognigt 12 STRP3 29.4286 28.1429 9.6065 10.4152 0.40625 1
3 Cognigt 15 MMSE 27.5 26.8333 2.51 2.6394 0.625 1
; run;
proc report data= AAA split = '^' ;
title1 "Appendix 1: Baseline Data";
column grpname tn Mean_baseline Std_baseline Mean_12_months std_12_months prob_change;
define grpname/group width=10 order=data;
define tn/group width=10 order=data;
define Mean_baseline / display format=5.1'Baseline ^Mean' ;
define Std_baseline/ display format= 5.1 'Baseline ^ Std';
define Mean_12_months / display format=5.1 'Month 12^Mean';
define std_12_months/display format=5.1 'Month 12 ^ Std';
define prob_change/ display format=5.3 'Change^P-value';
run;
I do not think PROC REPORT can produce a format (even with custom format or pictures) like 33.9(6.2).
Why don't you use the DATA step method I provided for one of your earlier threads?
Thank you.
I asked the same question about using formats and the response i got was vague. Hence why i opted for proc report as someone suggested earlier.
Please if i can't get output exactly in proc report, how do i:
1. Make the groupnames "Motor" "Physical" and "cognit" appear above their respective testnames.
2. How do i create a space to demarcate one groupname from another like in the excel pic.
@ChuksManuel wrote:
Thank you.
I asked the same question about using formats and the response i got was vague. Hence why i opted for proc report as someone suggested earlier.
Please if i can't get output exactly in proc report, how do i:
1. Make the groupnames "Motor" "Physical" and "cognit" appear above their respective testnames.
It's the exact same concept that enabled us to put BMI in a different format as the last line of the previous example.
2. How do i create a space to demarcate one groupname from another like in the excel pic.
I put spaces in the DATA step example, it's the same.
Like this?
data CLASS;
length NAME $16;
set SASHELP.CLASS(where=(SEX='M' & AGE=14))
SASHELP.CLASS(where=(SEX='F' & AGE=14));
run;
proc report data= CLASS;
column SEX WEIGHT=WMAX NAME ;
define SEX / order order=data;
define NAME / order ;
define WMAX / analysis max noprint;
compute NAME;
NAME=catt(NAME,' (',put(WMAX,8.2 -l),')');
endcomp;
run;
Sex | NAME |
---|---|
M | Alfred (112.50) |
Henry (102.50) | |
F | Carol (102.50) |
Judy (90.00) |
proc report data= AAA split= '^';
title1 "Appendix 1: Baseline Data";
column grpname tn Meanbaseline Mean12months prob_change ;
define grpname/group width=10 order=data;
define tn/group width=10 order=data;
define Mean_baseline/computed 'Baseline Mean (Std)';
define Mean_12_months/computed 'Month 12 Mean (Std)';
compute Meanbaseline;
Meanbaseline=catt(Mean_baseline,' (',put(Std_baseline,5.1),')');
endcomp;
compute Mean12months;
Mean12months=catt(Mean_12_months,' (',put(Std_12_months,5.1),')');
endcomp;
run;
Thank you Chris.
Do you know how i can fit this into my code? It gave me an error message. Saying the variables are numeric.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.