Date: Fri, 18 Aug 2006 11:45:13 -0400
Reply-To: "Dorfman, Paul" <paul_dorfman@MERCK.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Dorfman, Paul" <paul_dorfman@MERCK.COM>
Subject: Re: Manipulate word list
Content-Type: text/plain
Yom,
What is the rule? If it is "create a new macro variable similar to LIST,
containing only the blank-delimited tokens var1 var3 var4 var6" then what is
wrong with
%let new_list = var1 var3 var4 var6 ;
I suspect you have something else in mind, though. Maybe "regardless of the
content of the blank-delimited LIST, eliminate the tokens var2 and var5 from
it"? Why, there are many ways of going about it. Say,
%let list = "var1 var2 var3 var4 var5 var6";
%let kill = var2 var5 ;
data _null_ ;
retain list &list ;
do _n_ = 1 by 1 while (1) ;
token = scan ("&kill", _n_) ;
if missing (token) then leave ;
list = tranwrd (list, strip (token), '') ;
end ;
call symput ('newlist', quote (strip (compbl (list)))) ;
run ;
Kind regards
------------
Paul Dorfman
Jax, FL
------------
+-----Original Message-----
+From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On
+Behalf Of yom
+Sent: Friday, August 18, 2006 5:56 AM
+To: SAS-L@LISTSERV.UGA.EDU
+Subject: Manipulate word list
+
+
+Dear All,
+
+ Do you know if there exists a tutorial how to manipulate the
+lists? For
+example, I would like to drop a few words from a list.
+
+%let list = "var1 var2 var3 var4 var5 var6";
+
+Please do you know how to obtain the new list "var1 var3 var4 var6" ?
+
+Thank you very much.
+
+yom
+
+
------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system.
------------------------------------------------------------------------------
|