Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro Variable Resolution in put statement (into a file)

Status
Not open for further replies.

robbo69er

Programmer
Nov 13, 2009
1
GB
Hi All,

I'm trying to create a output file that is created in a null datastep via a series of put statements.

Resolving macro variables in some areas is fine, however, the following part i cannot get to resolve either side of the = sign:
where c1 = 1

outstring='<Testing1 &c1.="'||strip(&c1.)||'"/>';
put outstring;


this resolves to:
<Testing1 &c1.="1"/>

changing the single quotes to double quotes simply reverses the macro variables above that resolve and that dont.

Is there any way to get both instances of the macro variable to resolve?

Thanks,

Rob.
 
Its because of the single quotes. Macro variables do not resolve inside single quotes. You must use double quotes.

Code:
   outstring='<Testing1 ' ||"&c1"||'="'||strip("&c1")||'"/>';
   put outstring;

Note the the macro variable is always inside double quotes.

Klaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top