Date: Fri, 31 May 2002 12:52:31 +0200
Reply-To: Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Subject: Re: Macro Variable w/ Special Characters
Content-Type: text/plain; charset="iso-8859-1"
Hi Wing,
By applying quoting functions like %NRSTR, %NRQUOTE, %NRBQUOTE:
%LET Desc = %NRBQUOTE(ABC"D・E);
%PUT Desc = &Desc;
%PUT Desc = %UNQUOTE(&Desc);
or:
%LET Desc = %NRQUOTE(ABC%"D・E); %* Note percent sign before double quote;
%PUT Desc = &Desc;
%PUT Desc = %UNQUOTE(&Desc);
Refer to as %UNQUOTE(&Desc) in data step, e.g. a character value or variable
label within double quotes. But here, with an embedded double quote this is
not possible, or you should take take to embed two double quotes, or:
1 %LET Desc = %NRBQUOTE(ABC"D・E);
2 %PUT Desc = &Desc;
Desc = ABC"D・E
3 %*PUT Desc = %UNQUOTE(&Desc);
4
5 DATA _NULL_;
6 * Value = "%UNQUOTE(&Desc)";
7 Value = "&Desc";
8 PUT Value;
9 RUN;
ABC"D・E
NOTE: The DATA statement used 0.5 seconds.
Regards - Jim.
--
Y. (Jim) Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070
senior statist./data man. P.O. Box 1 fax. +31 412 407 080
J.Groeneveld@ITGroups.com 5350 AA BERGHEM, NL www.imrotramarko.com
Computers aren't there to be kept busy, but to keep us busy.
Notice of confidentiality: this e-mail may contain confidential information
intended for the addressed recipient only.
If you have received this e-mail in error please delete this e-mail and
please notify the sender so that proper delivery
can be arranged.
> -----Original Message-----
> From: Wing [SMTP:wstsui@IRD.GOV.HK]
> Sent: Friday, May 31, 2002 12:25 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Macro Variable w/ Special Characters
>
> Dear All,
>
> Please help.
>
> How can I make use of a macro variable which contains special characters
> (such as ' " ; & %)?
>
> I have a macro variable, &DESC1, having the value, say, ABC"D・E.
> And I'd like to assign this macro variable to a dataset variable within a
> data-step. How can I achieve it?
>
> Please help!
>
> Thanks a lot.
>
> Wing.