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

Hi,

 

I am trying to export into xml file using ods tagset. I am providing the output file name by referring a macro variable.

 

Below is the code,

 

%macro Export(output1=, input1=, output2=, input2=, output3=, input3=);

%let t=%sysfunc(today());
%let monday=%sysfunc(intnx(week.2,&t,0,b),date9.);
%let outputdate=%substr(&monday,3,3)_%substr(&monday,1,2)_%substr(&monday,6);
%put &outputdate;

%let Bus = %scan(&output1.,1,_);
%put &Bus;

%let Business = %scan(&Bus,2,.);
%put &Business;

%let file = &Business._CM_ &outputdate;

%put &file;

ods tagsets.ExcelXP file="/sasconfig/Lev1/External/&file.xml" style=meadow
options (sheet_name = "&input1.");

 

 

So my file name is resolving to Canada_CM_ JAN_28_2019. But my output file is so different and I have attached screenshot of the output file.

 

When I modify the file withing brackets as below, I am getting the output xml file as (Canada_CM_ JAN_28_2019)

 

ods tagsets.ExcelXP file="/sasconfig/Lev1/External/(&file).xml" style=meadow
options (sheet_name = "&input1.");

 

But I want to export the xml file as Canada_CM_ JAN_28_2019 only.

 

Any suggestions

 

Thanks in advance!!

Vigneswar

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

When you do this:

ods tagsets.ExcelXP file="/sasconfig/Lev1/External/&file.xml" style=meadow

the dot immediately before the xml extension is "eaten" by the resolution of the macro variable.

Remember Maxim 48?

Do this:

ods tagsets.ExcelXP file="/sasconfig/Lev1/External/&file..xml" style=meadow

One dot ends the macro variable reference, the second dot ends up in the filename.

View solution in original post

4 REPLIES 4
Kurt_Bremser
Super User

When you do this:

ods tagsets.ExcelXP file="/sasconfig/Lev1/External/&file.xml" style=meadow

the dot immediately before the xml extension is "eaten" by the resolution of the macro variable.

Remember Maxim 48?

Do this:

ods tagsets.ExcelXP file="/sasconfig/Lev1/External/&file..xml" style=meadow

One dot ends the macro variable reference, the second dot ends up in the filename.

Vigneswar
Obsidian | Level 7
KurtBreamser,

Yep, you are right and the changes worked..

Thanks a lot !
Kurt_Bremser
Super User

Small hint: when you want to adress another poster personally, just hit "@", and a list of all participants in the current thread will pop up. Select the one you want, and he/she will end up like this:

@Vigneswar 

You avoid any misspelling, and the user is notified per mail. You can even "call out" any of the registered users, if you enter enough characters of the username for a positive identification after the "@".

Vigneswar
Obsidian | Level 7
@Kurt_Bremser yeah sure!! Thanks for the tip.

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!

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
  • 4 replies
  • 1087 views
  • 1 like
  • 2 in conversation