Dear all,
I need to merge two datasets (a) & (b). My problem is that in the two datasets the identification-variable X1 is coded differently. To illustrate, in dataset (a) the identification-variable X1 is coded as 1 2 3 ... and so forth. In dataset (b) the identification-variable is codes as 01 02 03 ... and so forth. Specifically, I am wondering how I could delete the first digit (zero) of the identification variable in the second dataset. I tried the substring-command, but that didn’t work…Could anybody help me with suitable syntax? Many thanks in advance, Nina |
The solution will depend on the data types.
Is the ID variable string in both files? Or string in one file and numeric
in the other?
Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] From: nina <[hidden email]> To: [hidden email] Date: 05/31/2016 12:33 PM Subject: How to delete the first digit Sent by: "SPSSX(r) Discussion" <[hidden email]> Dear all, I need to merge two datasets (a) & (b). My problem is that in the two datasets the identification-variable X1 is coded differently. To illustrate, in dataset (a) the identification-variable X1 is coded as 1 2 3 ... and so forth. In dataset (b) the identification-variable is codes as 01 02 03 ... and so forth. Specifically, I am wondering how I could delete the first digit (zero) of the identification variable in the second dataset. I tried the substring-command, but that didn’t work…Could anybody help me with suitable syntax? Many thanks in advance, Nina -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/How-to-delete-the-first-digit-tp5732287.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== 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 |
Administrator
|
Adding to Rick's questions, are there any IDs that contain non-numeric characters? If it is possible to treat ID as numeric in both files, then do so, and your life will be much easier. ;-)
Use ALTER TYPE to convert a string version of ID to numeric.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Administrator
|
In reply to this post by nina
" but that didn’t work…"
What are the data types in each file? What exactly did you do with SUBSTR? What exactly do you mean by " but that didn’t work…"? Please post any error messages along with answers to these other questions.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Free forum by Nabble | Edit this page |