BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Niugg2010
Obsidian | Level 7

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

 Capture1.JPG

 

Below is what I want,  Filled with Gr1 


Capture1.JPGCapture2.JPG

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

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.

View solution in original post

4 REPLIES 4
FreelanceReinh
Jade | Level 19

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.

Niugg2010
Obsidian | Level 7

Thanks a lot.

If there is an option to control grouped value display, it will be great.

 

 

shahsn11
Fluorite | Level 6

Could you post the solution that work for you.

 

Thanks.

Niugg2010
Obsidian | Level 7

 

 

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;

 

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1535 views
  • 0 likes
  • 3 in conversation