Date: Sat, 19 Aug 2006 01:44:54 -0400
Reply-To: Joe Whitehurst <joewhitehurst@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Whitehurst <joewhitehurst@GMAIL.COM>
Subject: Re: Manipulate word list
In-Reply-To: <6aa258df0608180255y22dcdb76s97e7ca2c7d7263df@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Yom,
I agree with David. Forget using the Antiquated Macro Language.
Storing the list items in a SAS dataset is far easier than mucking
with lame Macros, Even easier, from an enlightened programmer's
perspective, would be to store the list items in a data structure
specifrically designed by SAS Institute for dealing with lists of
items, namely, a SAS Component Language List, e.g., in your specific
case you would simply code:
*Create and populate the list;
dcl list my_word_list={'var1','var2','var3','var4','var5','var6'};
*Delete specific items by index;
do i=2,5;
my_word_list=delitem(my_word_list,i);
end;
There are more than 25 powerful functions for searching, ordering,
listing, saving, protecting, etc. list items. And, as if that were
not enough,. a list can have another list as a list item. A given
list can even be a list element of itself!
Joe,
Joe
On 8/18/06, yom <yomsas@gmail.com> wrote:
> 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
>
|