DATA Step, Macro, Functions and more

How to resolve a macro-variable within simple quotes ?

Reply
Contributor
Posts: 36

How to resolve a macro-variable within simple quotes ?

Hi,
I am using ods ods tagsets.excelxp to make an xls file.

I need to customize the header with a macro-variable.

The Print_Header statement :

Print_Header='&E Fichier audité : ' &fichierATraiter
Produces a syntax error.

Print_Header='&E Fichier audité : &fichierATraiter'
Works but the header of the xls file is Fichier audité : ichierATraiter
instead of Fichier audité :
followed by the value of &fichierATraiter.

What syntax would be correct ?
Thanks.

Phil
Frequent Contributor
Posts: 127

Re: How to resolve a macro-variable within simple quotes ?

Hi,

Couldn't you use the following statement ?

Print_Header="&E Fichier audité : &fichierATraiter"

Regards,
Florent
Contributor
Posts: 36

Re: How to resolve a macro-variable within simple quotes ?

Thanks Florent,
it works but in this case the Excel layout doesn't work no more; & is not recognized by sas.

phil
Frequent Contributor
Posts: 127

Re: How to resolve a macro-variable within simple quotes ?

Phil,

What & are you talking about ?

It doesn't appear in your first message.

Florent
Contributor
Posts: 36

Re: How to resolve a macro-variable within simple quotes ?

Excuse me, I meant &E. &Amp was for the footer.

phil
Frequent Contributor
Posts: 127

Re: How to resolve a macro-variable within simple quotes ?

Ok Smiley Happy

Could you try with the following statement ?
Print_Header='&E Fichier audité : ' || "&fichierATraiter"

Florent
Contributor
Posts: 36

Re: How to resolve a macro-variable within simple quotes ?

This syntax works well :

Print_Header="%nrstr(&)E Fichier audité : &fichierATraiter"

Thank you for your help.

phil
Ask a Question
Discussion stats
  • 6 replies
  • 402 views
  • 0 likes
  • 2 in conversation