DATA Step, Macro, Functions and more

using a macro in a file name in ods

Reply
N/A
Posts: 0

using a macro in a file name in ods

Hi,
I'm trying to export a file to excel and then sent am e-mail with a link to the xls file,
the name of the file contains macros for the date and time, but when I add the time macro, the file created is not recognized as an xls file.
the here is the code :

***************************************************
data _null_;
a=time();
dc=put (a,time5.);
dc=substr (dc,1,2)||':'||substr (dc,4,2);
call symput ('data_time',dc);
run;

%put &data_time;


ods tagsets.test options(embedded_titles='Yes')
file="&path\sasoutputs\tayar_untypical&sysdate&data_time..xls"
style=XLSasweb;
title;

ods tagsets.test alias="cards";


proc print data=mydblib.tayar_auth_final noobs label;
var card_number
country_name

run;

ods _all_ close;



filename emailmsg email
to=("sivana@gmail.com")
FROM='The SAS System '
subject=cards';

DATA _NULL_;
FILE emailmsg;
PUT ;
PUT ;
PUT HREF="\\netapp01\users \SasOutputs\tayar_untypical&sysdate&data_time..xls";
run;

filename emailmsg;
**********************************************************

What can I do to solve the problem?
Thanks,
Sivan
Super Contributor
Super Contributor
Posts: 3,174

Re: using a macro in a file name in ods

Choose a different character than the colon in your time-portion of your file name -- it must be compatible with file-naming strings.

Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: using a macro in a file name in ods

Thank you!
N/A
Posts: 0

Re: using a macro in a file name in ods

Hi,
I did what you said, but now there is a problem with the link that appears in the mail, it looks like this :

HREF=. \\netapp01\users\SasOutputs\tayar_untypial_auth_from_today\tayar_untypical15JUN09' 8_40.xls

Seems like the second macro is not recognized as a part of the link, what can I do?
Thanks,
Sivan Message was edited by: sivana
Super Contributor
Super Contributor
Posts: 3,174

Re: using a macro in a file name in ods

Clearly you have an imbedded blank character somewhere in your SAS code. Suggest you perform some self-diagnosis by adding the stmt below to generate more SAS log output while SAS is compiling the code:

OPTIONS SOURCE SOURCE2 MACROGEN SYMBOLGEN;


Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 4 replies
  • 151 views
  • 0 likes
  • 2 in conversation