Below is my code and output.
data a;
input gr $ TRT $ Visno $ Param $ value;
datalines;
Gr1 TRT1 v1 A 8
Gr1 TRT1 v1 B 6
Gr1 TRT1 v1 C 5
Gr1 TRT1 v2 A 6
Gr1 TRT1 v2 B 7
Gr1 TRT1 v3 C 8
Gr1 TRT2 v1 A 3
Gr1 TRT2 v1 B 7
Gr1 TRT2 v1 C 5
Gr1 TRT2 v2 A 10
Gr1 TRT2 v2 B 6
Gr1 TRT2 v3 C 10
Gr2 TRT3 v1 A 10
Gr2 TRT3 v1 B 16
Gr2 TRT3 v1 C 18
Gr2 TRT3 v2 A 14
Gr2 TRT3 v2 B 11
Gr2 TRT3 v3 C 15
;
proc report data=a nocompletecols;
column gr trt visno, (param, value);
define gr / group ;
define trt / group;
define visno / across;
define param / across;
run;
In output, the gr column has a blank and it should be filled with 'Gr1'. How can I fill the blank with gr value? please advice thanks.
Below is the output, with blank in gr column
Below is what I want, Filled with Gr1
Hi @Niugg2010,
Most probably, you can adapt the solution I provided to another user in 2016:
PDF Report: How to let a group variable show up multiple times
I think in the last COMPUTE block you won't need the IF condition.
Hi @Niugg2010,
Most probably, you can adapt the solution I provided to another user in 2016:
PDF Report: How to let a group variable show up multiple times
I think in the last COMPUTE block you won't need the IF condition.
Thanks a lot.
If there is an option to control grouped value display, it will be great.
Could you post the solution that work for you.
Thanks.
Below is my code based on the above link method. This works well, but not best.
proc report data=a nocompletecols;
column gr _gr trt visno, (param, value);
define gr / group noprint;
define trt / group;
define visno / across;
define param / across;
define _gr/ computed;
compute before gr;
temp=gr;
endcomp;
compute _gr / character length=8;
_gr=temp;
endcomp;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.