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 (April 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 20 Apr 2009 14:55:29 -0700
Reply-To:     "Andrew Z." <ahz001@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Andrew Z." <ahz001@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Parse log contained in one variable
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

I recently started to learn SAS (9.1/Windows), and now I need to parse a log. Read from an ODBC source (with a poor design which I can't change), each person has a single log with multiple events crammed in a single variable. I want to break apart the log into multiple observations and multiple variables, so I can use it like a database. I've seen how to do this in SAS from a text file (INFILE/CARDS) but not from ODBC. Please point me in the right direction.

An example of the log for one person 4/20/2009 15:46:13 John Smith: I processed transaction foo 4/19/2009 13:10:09 John Doe: Customer asked us to process transaction foo

If I were using a general purpose language like Python, I would use split('\n') to split the log into multiple variables. Then, I would parse out the date, time, creator's name, and comment using a POSIX or Perl regular expression. Then, I would store the parsed data in a new database table.

Andrew


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