Syntax help for matching string data

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Syntax help for matching string data

Adam Maltese
Hello. I'm hoping someone might be able to provide some guidance. I'm trying
to work through a large data set with multiple course records for students.
In an effort to make the data file more manageable, I'm going through the
file and compressing all classes that represent the same course (e.g.,
Calculus split over two semesters). In doing this, I've found that the
values for the CourseName variable differ slightly for many of the cases
(e.g., Calc1A & Calc1B). Because this is not an exact match, I can't come up
with an automated way to evaluate the strings to see if the first few
letters match up. I tried to create syntax using the SUBSTR command in a
conditional statement, but that did not work. If anyone has any ideas about
how to solve this, please let me know. Thank you for your input.



Cheers,

Adam Maltese

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Syntax help for matching string data

Norton, John
Hi Adam,

Maybe something like this could help:

IF (SUBSTR(LTRIM(RTRIM(UPCASE(course1))),1,3) =
  SUBSTR(LTRIM(RTRIM(UPCASE(course2))),1,3)) course_cat =
  SUBSTR(LTRIM(RTRIM(UPCASE(course2))),1,3).

This assumes that you are evaluating only the first 3 characters in your course ID.

HTH,

John

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Adam Maltese
Sent: Wednesday, January 09, 2008 2:41 PM
To: [hidden email]
Subject: Syntax help for matching string data

Hello. I'm hoping someone might be able to provide some guidance. I'm trying
to work through a large data set with multiple course records for students.
In an effort to make the data file more manageable, I'm going through the
file and compressing all classes that represent the same course (e.g.,
Calculus split over two semesters). In doing this, I've found that the
values for the CourseName variable differ slightly for many of the cases
(e.g., Calc1A & Calc1B). Because this is not an exact match, I can't come up
with an automated way to evaluate the strings to see if the first few
letters match up. I tried to create syntax using the SUBSTR command in a
conditional statement, but that did not work. If anyone has any ideas about
how to solve this, please let me know. Thank you for your input.



Cheers,

Adam Maltese

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD