|
I run Crosstabs a lot, and one of the first things I almost always do with
the results is to reformat the wasteful space in the first 1-2 columns. That is, * the uppermost cell on the left is always blank, * The only thing in the first column is the name of the variable * the lowermost cell on the left always has "Total" spread over the first two columns. So the first thing I always do is to manually * split the uppermost and lowermost cells on the left, * move the word "Total" from the first column to the empty cell at the bottom of the second column * move the variable name from the first column to the empty cell at the top of the second column, and then * delete the now-empty first column Can this task be automated so that SPSS prints the first two columns the "right" way all the time? I currently have both ver. 12 and ver.16. Thanks in advance, Bob Robert M. Schacht, Ph.D. <[hidden email]> Pacific Basin Rehabilitation Research & Training Center 1268 Young Street, Suite #204 Research Center, University of Hawaii Honolulu, HI 96814 ===================== 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 |
|
It seems like most of what you want could be accomplished by just narrowing the leftmost label column and letting the pivot table wrap accordingly. This, or the more complex rearrangements outlined below, could be done with an autoscript that would trigger automatically each time a crosstab is run.
With version 17, you could bypass the script writing and just use the SPSSINC MODIFY TABLES extension command. To narrow the leftmost label column, it might look like SPSSINC MODIFY TABLES subtype="Crosstabulation" SELECT=<<ALL>> PROCESS = PRECEDING /WIDTHS ROWLABELS = 1 ROWLABELWIDTHS = 50 /STYLES APPLYTO=DATACELLS. To do the more complex rearrangement, you could use the CUSTOMFUNCTION keyword of this command and supply a Python code snippet that would just do the rearrangements. But with 16 (or 12) the autoscript route would work. HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bob Schacht Sent: Thursday, November 06, 2008 6:29 PM To: [hidden email] Subject: [SPSSX-L] Reformating crosstab tables I run Crosstabs a lot, and one of the first things I almost always do with the results is to reformat the wasteful space in the first 1-2 columns. That is, * the uppermost cell on the left is always blank, * The only thing in the first column is the name of the variable * the lowermost cell on the left always has "Total" spread over the first two columns. So the first thing I always do is to manually * split the uppermost and lowermost cells on the left, * move the word "Total" from the first column to the empty cell at the bottom of the second column * move the variable name from the first column to the empty cell at the top of the second column, and then * delete the now-empty first column Can this task be automated so that SPSS prints the first two columns the "right" way all the time? I currently have both ver. 12 and ver.16. Thanks in advance, Bob Robert M. Schacht, Ph.D. <[hidden email]> Pacific Basin Rehabilitation Research & Training Center 1268 Young Street, Suite #204 Research Center, University of Hawaii Honolulu, HI 96814 ===================== 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 |
|
In reply to this post by Bob Schacht-3
I also do this a lot, and up until version 15, I could simply ungroup
the first column of empty space to make it go away. In v17.0 this option is not accessible (greyed out)??? -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bob Schacht Sent: Thursday, November 06, 2008 8:29 PM To: [hidden email] Subject: Reformating crosstab tables I run Crosstabs a lot, and one of the first things I almost always do with the results is to reformat the wasteful space in the first 1-2 columns. That is, * the uppermost cell on the left is always blank, * The only thing in the first column is the name of the variable * the lowermost cell on the left always has "Total" spread over the first two columns. So the first thing I always do is to manually * split the uppermost and lowermost cells on the left, * move the word "Total" from the first column to the empty cell at the bottom of the second column * move the variable name from the first column to the empty cell at the top of the second column, and then * delete the now-empty first column Can this task be automated so that SPSS prints the first two columns the "right" way all the time? I currently have both ver. 12 and ver.16. Thanks in advance, Bob Robert M. Schacht, Ph.D. <[hidden email]> Pacific Basin Rehabilitation Research & Training Center 1268 Young Street, Suite #204 Research Center, University of Hawaii Honolulu, HI 96814 ===================== 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 |
|
I can't get python to run in 17.0. I'm a total newbie here. Just trying
to get my feet wet in python to see what it can do. I run a lot of complicated aggregations and series of steps for my analyses on medical claims data and I wanted to see if python could allow me to automate the process so that I could just fill in some new information and rerun analyses as more up to date data comes in. I know this comes up a lot but I've checked the archives and didn't find an answer to my question. I've got the plug-in installed for Version 17.0. I've got all of the most up to date patches patched. I've got the invokepython.dll in my spss folder. I've tried a number of times to get this simple program to run: BEGIN PROGRAM. import spss print "Hello, world!" END PROGRAM. It starts to run but the windows brings up the window stating that spss has encountered an error and needs to close etc. SPSS hangs and then I need to hit ctrl-alt-delete to close it. Any ideas? Thanks Matt Matthew Pirritano, Ph.D. Research Analyst IV Medical Services Initiative (MSI) Orange County Health Care Agency (714) 834-3566 -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Roberts, Michael Sent: Friday, November 07, 2008 10:50 AM To: [hidden email] Subject: Re: Reformating crosstab tables I also do this a lot, and up until version 15, I could simply ungroup the first column of empty space to make it go away. In v17.0 this option is not accessible (greyed out)??? -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bob Schacht Sent: Thursday, November 06, 2008 8:29 PM To: [hidden email] Subject: Reformating crosstab tables I run Crosstabs a lot, and one of the first things I almost always do with the results is to reformat the wasteful space in the first 1-2 columns. That is, * the uppermost cell on the left is always blank, * The only thing in the first column is the name of the variable * the lowermost cell on the left always has "Total" spread over the first two columns. So the first thing I always do is to manually * split the uppermost and lowermost cells on the left, * move the word "Total" from the first column to the empty cell at the bottom of the second column * move the variable name from the first column to the empty cell at the top of the second column, and then * delete the now-empty first column Can this task be automated so that SPSS prints the first two columns the "right" way all the time? I currently have both ver. 12 and ver.16. Thanks in advance, Bob Robert M. Schacht, Ph.D. <[hidden email]> Pacific Basin Rehabilitation Research & Training Center 1268 Young Street, Suite #204 Research Center, University of Hawaii Honolulu, HI 96814 ===================== 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 ===================== 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 |
|
Matt, welcome to the Python world. I encountered the same situation and
found that my software firewall was the barrier. If you have one, set it to training or rules mode, restart SPSS, run your script and see what happens, for me a permissions screen popped up to allow the Python executable to run. Let me know WMB Statistical Services ============ mailto: [hidden email] http:\\home.earthlink.net\~info.statman ============ -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Pirritano, Matthew Sent: Friday, November 07, 2008 2:02 PM To: [hidden email] Subject: python installation I can't get python to run in 17.0. I'm a total newbie here. Just trying to get my feet wet in python to see what it can do. I run a lot of complicated aggregations and series of steps for my analyses on medical claims data and I wanted to see if python could allow me to automate the process so that I could just fill in some new information and rerun analyses as more up to date data comes in. I know this comes up a lot but I've checked the archives and didn't find an answer to my question. I've got the plug-in installed for Version 17.0. I've got all of the most up to date patches patched. I've got the invokepython.dll in my spss folder. I've tried a number of times to get this simple program to run: BEGIN PROGRAM. import spss print "Hello, world!" END PROGRAM. It starts to run but the windows brings up the window stating that spss has encountered an error and needs to close etc. SPSS hangs and then I need to hit ctrl-alt-delete to close it. Any ideas? Thanks Matt Matthew Pirritano, Ph.D. Research Analyst IV Medical Services Initiative (MSI) Orange County Health Care Agency (714) 834-3566 -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Roberts, Michael Sent: Friday, November 07, 2008 10:50 AM To: [hidden email] Subject: Re: Reformating crosstab tables I also do this a lot, and up until version 15, I could simply ungroup the first column of empty space to make it go away. In v17.0 this option is not accessible (greyed out)??? -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bob Schacht Sent: Thursday, November 06, 2008 8:29 PM To: [hidden email] Subject: Reformating crosstab tables I run Crosstabs a lot, and one of the first things I almost always do with the results is to reformat the wasteful space in the first 1-2 columns. That is, * the uppermost cell on the left is always blank, * The only thing in the first column is the name of the variable * the lowermost cell on the left always has "Total" spread over the first two columns. So the first thing I always do is to manually * split the uppermost and lowermost cells on the left, * move the word "Total" from the first column to the empty cell at the bottom of the second column * move the variable name from the first column to the empty cell at the top of the second column, and then * delete the now-empty first column Can this task be automated so that SPSS prints the first two columns the "right" way all the time? I currently have both ver. 12 and ver.16. Thanks in advance, Bob Robert M. Schacht, Ph.D. <[hidden email]> Pacific Basin Rehabilitation Research & Training Center 1268 Young Street, Suite #204 Research Center, University of Hawaii Honolulu, HI 96814 ===================== 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 ===================== 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
Will
Statistical Services ============ info.statman@earthlink.net http://home.earthlink.net/~z_statman/ ============ |
|
I just had to change the location of my temp file to a path and folder
name that did not have a space in it. That fixed it. Who'd have known! Thanks to Richard Oliver for his help. Matthew Pirritano, Ph.D. Research Analyst IV Medical Services Initiative (MSI) Orange County Health Care Agency (714) 834-3566 -----Original Message----- From: Statmanz [mailto:[hidden email]] Sent: Friday, November 07, 2008 12:07 PM To: Pirritano, Matthew; [hidden email] Subject: RE: python installation Matt, welcome to the Python world. I encountered the same situation and found that my software firewall was the barrier. If you have one, set it to training or rules mode, restart SPSS, run your script and see what happens, for me a permissions screen popped up to allow the Python executable to run. Let me know WMB Statistical Services ============ mailto: [hidden email] http:\\home.earthlink.net\~info.statman ============ -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Pirritano, Matthew Sent: Friday, November 07, 2008 2:02 PM To: [hidden email] Subject: python installation I can't get python to run in 17.0. I'm a total newbie here. Just trying to get my feet wet in python to see what it can do. I run a lot of complicated aggregations and series of steps for my analyses on medical claims data and I wanted to see if python could allow me to automate the process so that I could just fill in some new information and rerun analyses as more up to date data comes in. I know this comes up a lot but I've checked the archives and didn't find an answer to my question. I've got the plug-in installed for Version 17.0. I've got all of the most up to date patches patched. I've got the invokepython.dll in my spss folder. I've tried a number of times to get this simple program to run: BEGIN PROGRAM. import spss print "Hello, world!" END PROGRAM. It starts to run but the windows brings up the window stating that spss has encountered an error and needs to close etc. SPSS hangs and then I need to hit ctrl-alt-delete to close it. Any ideas? Thanks Matt Matthew Pirritano, Ph.D. Research Analyst IV Medical Services Initiative (MSI) Orange County Health Care Agency (714) 834-3566 -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Roberts, Michael Sent: Friday, November 07, 2008 10:50 AM To: [hidden email] Subject: Re: Reformating crosstab tables I also do this a lot, and up until version 15, I could simply ungroup the first column of empty space to make it go away. In v17.0 this option is not accessible (greyed out)??? -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bob Schacht Sent: Thursday, November 06, 2008 8:29 PM To: [hidden email] Subject: Reformating crosstab tables I run Crosstabs a lot, and one of the first things I almost always do with the results is to reformat the wasteful space in the first 1-2 columns. That is, * the uppermost cell on the left is always blank, * The only thing in the first column is the name of the variable * the lowermost cell on the left always has "Total" spread over the first two columns. So the first thing I always do is to manually * split the uppermost and lowermost cells on the left, * move the word "Total" from the first column to the empty cell at the bottom of the second column * move the variable name from the first column to the empty cell at the top of the second column, and then * delete the now-empty first column Can this task be automated so that SPSS prints the first two columns the "right" way all the time? I currently have both ver. 12 and ver.16. Thanks in advance, Bob Robert M. Schacht, Ph.D. <[hidden email]> Pacific Basin Rehabilitation Research & Training Center 1268 Young Street, Suite #204 Research Center, University of Hawaii Honolulu, HI 96814 ===================== 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 ===================== 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 |
|
There is a related resolution in the Knowledgebase at http://support.spss.com , which I've pasted below. (You can use 'guest', without the quotes, to log in to this site to access the knowledgebase.) As noted there, the problem will be fixed in the SPSS 17.0.1 patch, which is expected in mid-December. Until then, assign the temp file to a path and folder name without spaces, as noted by Matt and in the resolution below.
David Matheson SPSS Statistical Support ****** Resolution number: 80348 Created on: Oct 24 2008 Last Reviewed on: Oct 24 2008 Problem Subject: Changing the default directory for data files in Options breaks Python programming in SPSS Statistics 17.0 Problem Description: I have SPSS Statistics 17.0 installed and have applied the appropriate Python plug-in from DevCentral. In SPSS Statistics, I go to Options>File Locations. I've changed the directory for data files to a valid location other than the default location. After restarting SPSS Statistics, if I run any valid Python program block from a syntax window, such as: begin program. import spss spss.Submit('show all.') end program. The application hangs and can only be shut down with task manager. Changing the data files back to the original default file location doesn't work, nor does deleting the registry entry where this has been added. What is the problem? Resolution Subject: This problem has been reported to SPSS Development - Workaround Available Resolution Description: This problem has been reported to SPSS Development. It will be corrected in the next patch release for SPSS Statistics. As a workaround, please change the SPSS Temporary folder setting in the File Location tab under Edit->Options to a path which does not contain any blank spaces. For instance, the default temp file path is: C:\Documents and Settings\saldrich\Local Settings\Temp\ Change to: C:\temp\ We apologize for the inconvenience. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Pirritano, Matthew Sent: Friday, November 07, 2008 2:39 PM To: [hidden email] Subject: Re: python installation I just had to change the location of my temp file to a path and folder name that did not have a space in it. That fixed it. Who'd have known! Thanks to Richard Oliver for his help. Matthew Pirritano, Ph.D. Research Analyst IV Medical Services Initiative (MSI) Orange County Health Care Agency (714) 834-3566 -----Original Message----- From: Statmanz [mailto:[hidden email]] Sent: Friday, November 07, 2008 12:07 PM To: Pirritano, Matthew; [hidden email] Subject: RE: python installation Matt, welcome to the Python world. I encountered the same situation and found that my software firewall was the barrier. If you have one, set it to training or rules mode, restart SPSS, run your script and see what happens, for me a permissions screen popped up to allow the Python executable to run. Let me know WMB Statistical Services ============ mailto: [hidden email] http:\\home.earthlink.net\~info.statman ============ -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Pirritano, Matthew Sent: Friday, November 07, 2008 2:02 PM To: [hidden email] Subject: python installation I can't get python to run in 17.0. I'm a total newbie here. Just trying to get my feet wet in python to see what it can do. I run a lot of complicated aggregations and series of steps for my analyses on medical claims data and I wanted to see if python could allow me to automate the process so that I could just fill in some new information and rerun analyses as more up to date data comes in. I know this comes up a lot but I've checked the archives and didn't find an answer to my question. I've got the plug-in installed for Version 17.0. I've got all of the most up to date patches patched. I've got the invokepython.dll in my spss folder. I've tried a number of times to get this simple program to run: BEGIN PROGRAM. import spss print "Hello, world!" END PROGRAM. It starts to run but the windows brings up the window stating that spss has encountered an error and needs to close etc. SPSS hangs and then I need to hit ctrl-alt-delete to close it. Any ideas? Thanks Matt Matthew Pirritano, Ph.D. Research Analyst IV Medical Services Initiative (MSI) Orange County Health Care Agency (714) 834-3566 -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Roberts, Michael Sent: Friday, November 07, 2008 10:50 AM To: [hidden email] Subject: Re: Reformating crosstab tables I also do this a lot, and up until version 15, I could simply ungroup the first column of empty space to make it go away. In v17.0 this option is not accessible (greyed out)??? -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bob Schacht Sent: Thursday, November 06, 2008 8:29 PM To: [hidden email] Subject: Reformating crosstab tables I run Crosstabs a lot, and one of the first things I almost always do with the results is to reformat the wasteful space in the first 1-2 columns. That is, * the uppermost cell on the left is always blank, * The only thing in the first column is the name of the variable * the lowermost cell on the left always has "Total" spread over the first two columns. So the first thing I always do is to manually * split the uppermost and lowermost cells on the left, * move the word "Total" from the first column to the empty cell at the bottom of the second column * move the variable name from the first column to the empty cell at the top of the second column, and then * delete the now-empty first column Can this task be automated so that SPSS prints the first two columns the "right" way all the time? I currently have both ver. 12 and ver.16. Thanks in advance, Bob Robert M. Schacht, Ph.D. <[hidden email]> Pacific Basin Rehabilitation Research & Training Center 1268 Young Street, Suite #204 Research Center, University of Hawaii Honolulu, HI 96814 ===================== 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 ===================== 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 ===================== 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 |
|
In reply to this post by Peck, Jon
Hello,
In the BASIC programming language there is a Left$ string function that allows you to take a given number of chars from the left side for a string. Left$(stringname,5). Can someone tell me what this function would be in SPSS? Thank you ===================== 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 |
|
Try this - if not exactly what you want look in help for string functions.
CHAR.SUBSTR. CHAR.SUBSTR(strexpr,pos[,length]). String. Returns the substring beginning at character position pos of strexpr. The optional third argument represents the number of characters in the substring. If the optional argument length is omitted, returns the substring beginning at character position pos of strexpr and running to the end of strexpr. For example CHAR.SUBSTR('abcd', 2) returns 'bcd' and CHAR.SUBSTR('abcd', 2, 2) returns 'bc'. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lombardo, Barbara Sent: 12 February 2009 03:36 PM To: [hidden email] Subject: LEFT STRING? Hello, In the BASIC programming language there is a Left$ string function that allows you to take a given number of chars from the left side for a string. Left$(stringname,5). Can someone tell me what this function would be in SPSS? Thank you ===================== 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 |
|
If the string length varies, replace "pos" below with LENGTH(strexpr)-newlength. In your case it looks like you would want something like:
String newstr (A5). Compute newstr=char.substr(stringname,length(stringname)-5)). If there are trailing blanks you may need to put this within an RTRIM command. Melissa Ives -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Mark Webb Sent: Thursday, February 12, 2009 7:51 AM To: [hidden email] Subject: Re: [SPSSX-L] LEFT STRING? Try this - if not exactly what you want look in help for string functions. CHAR.SUBSTR. CHAR.SUBSTR(strexpr,pos[,length]). String. Returns the substring beginning at character position pos of strexpr. The optional third argument represents the number of characters in the substring. If the optional argument length is omitted, returns the substring beginning at character position pos of strexpr and running to the end of strexpr. For example CHAR.SUBSTR('abcd', 2) returns 'bcd' and CHAR.SUBSTR('abcd', 2, 2) returns 'bc'. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lombardo, Barbara Sent: 12 February 2009 03:36 PM To: [hidden email] Subject: LEFT STRING? Hello, In the BASIC programming language there is a Left$ string function that allows you to take a given number of chars from the left side for a string. Left$(stringname,5). Can someone tell me what this function would be in SPSS? Thank you ===================== 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 PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. ===================== 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 |
| Free forum by Nabble | Edit this page |
