BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Kc2
Quartz | Level 8 Kc2
Quartz | Level 8

Hello,

 

I am generating a report using proc report and need the column header to print either A Period   or B Period based on the value of the variable trtn in my dataset. An if/else statement does not work.  Can anyone provide a suggestion?

 

thank you

KC

Kc2_1-1668093080382.png

proc report data=final style=[outputwidth=100%];
columns trtn ord ("__Period A______________________________________________________________________________________________________"
c1 ("______________________________CTCAE Grade______________________________" c3 c4 c5 c6 c7));
/* if trtn=3 then columns trtn ord ("__Period B___________________________________________________________________________________________________" */
/* c1 ("______________________________CTCAE Grade______________________________" c3 c4 c5 c6 c7)); */

define trtn /order noprint order=internal;
define ord /order noprint order=internal;
define c1 /group display "System Organ Class/^ Preferred Term [1]" style(column)=[cellwidth=20% just=LEFT asis=on] style(header)=[just=l];

define c3 / "Grade 1/^[Events] (%)" style(column)=[cellwidth=11% just=c] flow;
define c4 / "Grade 2/^[Events] (%)" style(column)=[cellwidth=11% just=c] flow;
define c5 / "Grade 3/^[Events] (%)" style(column)=[cellwidth=11% just=c] flow;
define c6 / "Grade 4/^[Events] (%)" style(column)=[cellwidth=11% just=c] flow;
define c7 / "Grade 5/^[Events] (%)" style(column)=[cellwidth=11% just=c] flow;


break after trtn / page;
compute after ord;
line ' ';
endcomp;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  Unless you used BY group processing so you could create a report for every value of TRTN, I think you might need a SAS Macro program, something like this:

Cynthia_sas_0-1668096835270.png

  This is not the exact format as your output, since it uses SASHELP.CLASS for the example, but it illustrates the general concept. There are other ways to write the macro program, of course, but I based this on an example I already had available.

Cynthia

 

View solution in original post

1 REPLY 1
Cynthia_sas
SAS Super FREQ

Hi:

  Unless you used BY group processing so you could create a report for every value of TRTN, I think you might need a SAS Macro program, something like this:

Cynthia_sas_0-1668096835270.png

  This is not the exact format as your output, since it uses SASHELP.CLASS for the example, but it illustrates the general concept. There are other ways to write the macro program, of course, but I based this on an example I already had available.

Cynthia

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 451 views
  • 0 likes
  • 2 in conversation