BookmarkSubscribeRSS Feed
George_S
Fluorite | Level 6

data have;

input x y;

cards;

1         2

1         1

5         2

0         3

3         1

1         3

1         3

0         1

6         5

1        0

4        2

1        4

0        1

;

wanted:(excel file,,use proc report ,with summation of y,  sum=28)

x        y

1         2

1         1

5         2

0         3

3         1

1         3

1         3

0         1

6         5

1        0

4        2

1        4

0        1

          28

Thanks

4 REPLIES 4
Ksharp
Super User

EASY.

data have;
input x y;
cards;
1         2
1         1
5         2
0         3
3         1
1         3
1         3
0         1
6         5
1        0
4        2
1        4
0        1
;
run;
ods listing close;
ods tagsets.excelxp file='c:\total.xls' style=sasweb;
proc report data=have nowd;
column x y;
define x/display;
define y/analysis sum;
rbreak after/summarize;
run;
ods tagsets.excelxp close;
ods listing;


Ksharp

Message was edited by: xia keshan

George_S
Fluorite | Level 6

Thank you Ksharp!

One more question is how to change the style to make the cells looks like the regular excel cells? That is remove the cells filling and border(set no border,no fill in excel).

Thanks!

Cynthia_sas
SAS Super FREQ

Hi:

  Chiming in with my .02...when you use ODS TAGSETS.EXCELXP and ODS HTML, the assumption is that you WANT the style to be used. You can try to change to STYLE=MINIMAL on your ODS statement. However, if you want NONE of the formatting that comes with these two ODS destinations, then you can try ODS CSV as your destination, which creates a comma-delimited file -- that will open in Excel and look like a "regular" Excel file -- as though you had just typed the numbers into the cells.

cynthia

Ksharp
Super User

There is a workaround way. If you don't mind.

data have;
input x y;
cards;
1         2
1         1
5         2
0         3
3         1
1         3
1         3
0         1
6         5
1        0
4        2
1        4
0        1
;
run;
ods listing close;
proc report data=have nowd out=want(drop=_:);
column x y;
define x/display;
define y/analysis sum;
rbreak after/summarize;
run;
ods listing;
proc export data=want outfile='c:\want.xls' dbms=excel replace;run;

Ksharp

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1366 views
  • 3 likes
  • 3 in conversation