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

 I have the data that need to be output in Excel format, I am having difficulty how I can create a spanning extra cell like shown in the image. Thank you

data have;
input student age math1 math2 sci1 sci2;
cards;
01 10 36 34 54 45
02 12 34 43 45 56 
03 12 34 43 45 56 
04 16 34 43 15 46 
05 15 34 47 75 56 
06 12 34 43 35 76 
07 15 33 43 25 66 
08 14 34 43 55 56 
09 12 38 41 45 54 

;
run; 

ods listing close;
ods ESCAPECHAR = '^';
ods excel file="\desktop\est1.xlsx" 
options(sheet_name='LIFE Version'
  autofilter='all' ) style= SeasidePrinter   ;

/*BASELINE VERSION -LIFETIME*/

PROC REPORT data=have nowindows
					      style(report)=[font=("Times New Roman", 10pt) protectspecialchars=on]
					      style(header)=[font=("Times New Roman", 10pt, bold) backgroundcolor= yellow just=center protectspecialchars=on]
					      style(column)=[font=("Times New Roman", 10pt) protectspecialchars=on];
 *where cond2='Y';

      COLUMN    student age math1 math2 sci1 sci2;

      DEFINE student	/ "student" display style=[just=c vjust=t cellwidth=2.882cm /*tagattr='type:num format:Text'*/];
      DEFINE age 		/"Age" display style=[just=c vjust=t cellwidth=1.5cm /*tagattr='type:num format:Text'*/];
	  DEFINE math1		/ "Maths 1" display style=[just=c vjust=t cellwidth=1.882cm tagattr='type:num '];
      DEFINE math2 		/"Maths 2" display style=[just=c vjust=t cellwidth=2.5cm /*tagattr='type:num format:Text'*/];
      DEFINE sci1 		/"Science 1" display style=[just=c vjust=t cellwidth= 2 cm /*tagattr='type:num format:Text'*/];
      DEFINE sci2 		/"Science 2" display style=[just=c vjust=t cellwidth= 2 cm /*tagattr='type:num format:Text'*/];

run;

ods excel close;
ods listing close;

How I have 

SASuserlot_0-1687900208519.png

How I want

SASuserlot_1-1687900256129.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

This gets you closer:

  COLUMN    student age ('Maths Total' math1 math2) ('Science Total' sci1 sci2);

View solution in original post

2 REPLIES 2
Reeza
Super User

This gets you closer:

  COLUMN    student age ('Maths Total' math1 math2) ('Science Total' sci1 sci2);

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
  • 2 replies
  • 250 views
  • 3 likes
  • 2 in conversation