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

Hi,
I want to make more than 1 title (multi title / multi cell) in 1 row with ods excel.
What I want is

what-i-want.jpg

only 1 title like this is 

bef.jpg

ods excel file= "D:\test.xlsx" ;

proc odstext;
  p "A";
run;  
proc print data=sashelp.heart(obs=5);
 var Status;
run;
ods excel close;

For get what I want, I change odstext to

proc odstext;
  p "A" "B" "C";
run;

but it failed like this

667 proc odstext;
668 p "A" "B" "C";
___
22
76
ERROR: Syntax error while parsing WHERE clause.
ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &, *, **, +, -, /, <, <=, <>, =, >, >=, ?, AND, BETWEEN,
CONTAINS, EQ, GE, GT, IN, IS, LE, LIKE, LT, NE, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=.
ERROR 76-322: Syntax error, statement will be ignored.
669 run;

 

I'm happy if someone help me.

1 ACCEPTED SOLUTION

Accepted Solutions
t_ar_taat
Quartz | Level 8

I found a way for this with "declare odsout".
https://www.lexjansen.com/phuse/2014/cs/CS01_ppt.pdf

ods excel file= "D:\test.xlsx" ;

data _null_;
 declare odsout o();
 o.table_start();
 o.row_start();
 o.format_cell(text: 'text 1');
 o.format_cell(text: 'text 2');
 o.row_end();
 o.row_start();
 o.format_cell(text: 'text 3');
 o.format_cell(text: 'text 4');
 o.row_end();
 o.table_end();
 o.delete();
run;

proc print data=sashelp.heart(obs=5);
 var Status;
run;
ods excel close;

98.jpg

 

View solution in original post

3 REPLIES 3
t_ar_taat
Quartz | Level 8

Thank you, but your comment might be for my another question.[ Sheet_Interval='none' ]

https://communities.sas.com/t5/SAS-Programming/ODS-EXCEL-1-sheet-with-multi-proc-step-no-dividng-sep...

 

t_ar_taat
Quartz | Level 8

I found a way for this with "declare odsout".
https://www.lexjansen.com/phuse/2014/cs/CS01_ppt.pdf

ods excel file= "D:\test.xlsx" ;

data _null_;
 declare odsout o();
 o.table_start();
 o.row_start();
 o.format_cell(text: 'text 1');
 o.format_cell(text: 'text 2');
 o.row_end();
 o.row_start();
 o.format_cell(text: 'text 3');
 o.format_cell(text: 'text 4');
 o.row_end();
 o.table_end();
 o.delete();
run;

proc print data=sashelp.heart(obs=5);
 var Status;
run;
ods excel close;

98.jpg

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 1112 views
  • 0 likes
  • 2 in conversation