LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 20 Feb 2008 12:50:27 -0600
Reply-To:     "Smith, Curtis, Mr, DCAA" <Curtis.Smith@DCAA.MIL>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Smith, Curtis, Mr, DCAA" <Curtis.Smith@DCAA.MIL>
Subject:      Parsing a Character Variable-THANK YOU
Content-Type: text/plain; charset="iso-8859-1"

Wow! In a blazing fast 15 minutes, 0 seconds, Dave Scocca provided a simple, working solution. Within 2 minutes of Dave, data_null_ provided the same solution. And, a minute later, Toby Dunn responded with the same solution. THANKS!!! I knew I could count on SAS-L.

Curt

All:

Unfortunately for me, I am no longer paid to program SAS (boo), but still use it to get the job done. That being the case, I don't have time on the clock to solve a problem, and thus need your help. I have a SAS data set containing a character variable that contains an employee number, last name, first initial, and middle initial stored in a contiguous string in the following form:

employee number,colon delimiter,last name,comma delimiter,first initial,comma delimiter,middle initial

For example:

12345:SMITH,C,A

I want to parse this into four separate character variables (employee number, last name, first initial, and middle initial).

I'm looking at the character string matching functions, such as RXMATCH, to use to identify where the delimiters are located and then store the positions into macro variables. I could then use the macro variables in a series of SUBSTR functions to parse the character variable. However, I suspect there is a much more straightforward method, which I suspect some of the SAS-L wizards that I have come to know and admire would find to be child's play. To show my appreciation for a solution, I will gladly publicly thank those that help on SAS-L! What a deal!

*-----------------------------------------* | Curtis A. Smith | | Supervisory Auditor | | Defense Contract Audit Agency | | E-Mail: curtis.smith@dcaa.mil | *-----------------------------------------*


Back to: Top of message | Previous page | Main SAS-L page