Date: Thu, 6 Jan 2011 16:31:37 -0500
Reply-To: bbser 2009 <bbser2009@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: bbser 2009 <bbser2009@GMAIL.COM>
Subject: Re: partitioning a variable
In-Reply-To: <409880.46236.qm@web114413.mail.gq1.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"
Using scan() like this, all stuff before "-" becoming one word and returned.
country=scan(item, 1, "-");
You might need choose a suitable length for country, otherwise it is 200
characters long.
Max
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Karen L
Sent: January-06-11 10:39 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: [SAS-L] partitioning a variable
Hi,
I would like to extract a country name from a variable called 'Item'.
The variable 'Item' contains some other information as well as the country
name.
For example,
Item
Antigua and Barbuda - Independence Day Hello Hello
Canada - Columbus Day chair chair
Cape Verde - new years day Labor Day
.....
I would normally use "substr" to partitioning a variable; but, I don't think
I
can use it in this case because some country names are very very long.
Is there a way that I can capture the characters(country names) from 'Item'
which are showing before " - " ??
Thanks,
KR