BookmarkSubscribeRSS Feed
bibbnd
Fluorite | Level 6

I need to add 1 line of text and a space row at the top of the excel output file.

so row 1 should be ' Email ' and row 2 should be blank . than i want the data to start. 

tried the following 


ODS EXCEL file="sasdata/customer/bibbn/output/IQPMBLStuck_05022023.xlsx" ;
title1 'Email Address (Required) email@gmail.com'.
TITLE2 '  ';

proc print data=TENANT3 noobs;
run;

ODS EXCEL CLOSE;

 

it just says the file doesn't exist 

 

so the file would open and look like :

 

Email require: email@gmail.com

blank row

id  number address city state ca zipcode

 

2 REPLIES 2
ballardw
Super User

@bibbnd wrote:

I need to add 1 line of text and a space row at the top of the excel output file.

so row 1 should be ' Email ' and row 2 should be blank . than i want the data to start. 

tried the following 


ODS EXCEL file="sasdata/customer/bibbn/output/IQPMBLStuck_05022023.xlsx" ;
title1 'Email Address (Required) email@gmail.com'.
TITLE2 '  ';

proc print data=TENANT3 noobs;
run;

ODS EXCEL CLOSE;

 

it just says the file doesn't exist 

 

so the file would open and look like :

 

Email require: email@gmail.com

blank row

id  number address city state ca zipcode

 


So your problem is the PATH to the file likely doesn't exist. Best practice with SAS and files to always start with a Drive (in Windows) or disc mount point. Otherwise the path is relative to where SAS is executing which typically means looking for folders in the file system where the program is installed. Those subfolders typically won't exist and/or your IT department may have the program folders locked down so that you cannot write into them.

 

Hint: when you get errors you should include the log with the information. That means copy the CODE and all the messages from the log, on the forum open a text box using the </> icon above the message window and paste the text there. The text box is important because it preserves formatting of the diagnostic characters that SAS often provides.

 

I suspect that your "file not found" includes some additional path information that precedes "sasdata/customer/bibbn/output/IQPMBLStuck_05022023.xlsx" .

yabwon
Onyx | Level 15

Read the documentation for ODS EXCEL. Especially Example 1.

 

Code:

ODS EXCEL file="R:/IQPMBLStuck_05022023.xlsx" 
options(embedded_titles="yes");
;
title1 'Email Address (Required) email@gmail.com';

proc print data=sashelp.class noobs;
run;

ODS EXCEL CLOSE;

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



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