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
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
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Karen L
Sent: January-06-11 10:39 AM
Subject: [SAS-L] partitioning a variable
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
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
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 " - " ??