I have a long string variable (62 chars) with embedded underscore characters. Sample data:

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

I have a long string variable (62 chars) with embedded underscore characters. Sample data:

cherylscott02
I have a long string variable (62 chars) with embedded underscore characters.  Sample data:
 
THTR105_THTR205______                                          
ELEC101_ELEC101_ELEC151_____                                   
IRW101_IRW101_IRW151_IRW201_IRW201___                          
 
I want to retain the underscore within the string but remove all trailing occurrences of the string.  Here is what I wrote:
 
* remove trailing underscore.
string newvar (a62).
compute newvar = rtrim(oldvar, '_').
 
The syntax does not generate an error message.  It just runs, but the new variable still has the trailing underscores.  Any assistance would be appreciated.
 
 
Cheryl Scott
IR Data Manager
TMCC Integrate Implementation Team
Office of Institutional Research
Truckee Meadows Community College
[hidden email]
(775)673-8239 (w)
Reply | Threaded
Open this post in threaded view
|

Re: I have a long string variable (62 chars) with embedded underscore characters. Sample data:

Albert-Jan Roskam
Hi,

You need to trim the trailing blanks first:
compute new = rtrim(rtrim(old, " "), "_").

Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Before you criticize someone, walk a mile in their shoes, that way
when you do criticize them, you're a mile away and you have their shoes!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--- On Tue, 10/20/09, Cheryl Scott <[hidden email]> wrote:

> From: Cheryl Scott <[hidden email]>
> Subject: [SPSSX-L] I have a long string variable (62 chars) with embedded              underscore              characters.  Sample data:
> To: [hidden email]
> Date: Tuesday, October 20, 2009, 12:06 AM
>
>
>
>
> I have a long string variable (62 chars) with embedded
> underscore characters.  Sample data:
>
> THTR105_THTR205______
>
> ELEC101_ELEC101_ELEC151_____
>
> IRW101_IRW101_IRW151_IRW201_IRW201___
>
>
> I want to retain the underscore within the string but
> remove all trailing occurrences of the string.  Here
> is what I wrote:
>
> * remove trailing underscore.
> string newvar (a62).
> compute newvar = rtrim(oldvar, '_').
>
> The syntax does not generate an error message.
> It just runs, but the new variable still has the trailing
> underscores.  Any assistance would be appreciated.
>
>
>
> Cheryl Scott
> IR Data Manager
> TMCC Integrate Implementation
> Team
> Office of Institutional
> Research
> Truckee Meadows Community College
> [hidden email]
> (775)673-8239 (w)
>
>

=====================
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: I have a long string variable (62 chars) with embedded underscore characters. Sample data:

Oliver, Richard
Since blanks are trimmed by default, this could be simplified slightly to

compute new=rtrim(rtrim(old), "_").


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Albert-Jan Roskam
Sent: Tuesday, October 20, 2009 2:27 AM
To: [hidden email]
Subject: Re: I have a long string variable (62 chars) with embedded underscore characters. Sample data:

Hi,

You need to trim the trailing blanks first:
compute new = rtrim(rtrim(old, " "), "_").

Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Before you criticize someone, walk a mile in their shoes, that way
when you do criticize them, you're a mile away and you have their shoes!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--- On Tue, 10/20/09, Cheryl Scott <[hidden email]> wrote:

> From: Cheryl Scott <[hidden email]>
> Subject: [SPSSX-L] I have a long string variable (62 chars) with embedded              underscore              characters.  Sample data:
> To: [hidden email]
> Date: Tuesday, October 20, 2009, 12:06 AM
>
>
>
>
> I have a long string variable (62 chars) with embedded
> underscore characters.  Sample data:
>
> THTR105_THTR205______
>
> ELEC101_ELEC101_ELEC151_____
>
> IRW101_IRW101_IRW151_IRW201_IRW201___
>
>
> I want to retain the underscore within the string but
> remove all trailing occurrences of the string.  Here
> is what I wrote:
>
> * remove trailing underscore.
> string newvar (a62).
> compute newvar = rtrim(oldvar, '_').
>
> The syntax does not generate an error message.
> It just runs, but the new variable still has the trailing
> underscores.  Any assistance would be appreciated.
>
>
>
> Cheryl Scott
> IR Data Manager
> TMCC Integrate Implementation
> Team
> Office of Institutional
> Research
> Truckee Meadows Community College
> [hidden email]
> (775)673-8239 (w)
>
>

=====================
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
Reply | Threaded
Open this post in threaded view
|

Can't see some Multiple Response Sets in Custom Tables

Mike Pritchard
I've created several different multiple response sets with Analyze | Tables
| Multiple Response sets.  Some of them are visible when I create custom
tables with the Dialog, but others aren't and I can't figure out why.

I finally tried modifying  existing syntax to make a start, and this seems
to work.  But I'd rather see the Mult Resp Set in the dialog box so I can
easily mess around with the categories and subtotals.

What am I missing?  I'm guessing it is just a dumb thing I'm doing.  I'm
using SPSS V16

Thanks
Mike

_________________________________________________________________________
Mike Pritchard | [hidden email] | 5 Circles Research | 425-444-3410

=====================
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: I have a long string variable (62 chars) with embedded underscore characters. Sample data:

Bud Bliss
In reply to this post by Oliver, Richard
I think the problem here is the trailing characters aren't just blanks, but I don't have anything to show what they are. Might be safer to do a substring from the left up to a double underscore "__", assuming that a double underscore never occurs within the string of interest!

Meredith (Bud) Bliss
Crime Analyst - Beaverton Police Dept.
4755 SW Griffith Drive
Beaverton, OR 97005
503-526-2294 - Fax: 503-526-2541

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Oliver, Richard
Sent: Tuesday, October 20, 2009 12:45 PM
To: [hidden email]
Subject: Re: I have a long string variable (62 chars) with embedded underscore characters. Sample data:

Since blanks are trimmed by default, this could be simplified slightly to

compute new=rtrim(rtrim(old), "_").


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Albert-Jan Roskam
Sent: Tuesday, October 20, 2009 2:27 AM
To: [hidden email]
Subject: Re: I have a long string variable (62 chars) with embedded underscore characters. Sample data:

Hi,

You need to trim the trailing blanks first:
compute new = rtrim(rtrim(old, " "), "_").

Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Before you criticize someone, walk a mile in their shoes, that way
when you do criticize them, you're a mile away and you have their shoes!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--- On Tue, 10/20/09, Cheryl Scott <[hidden email]> wrote:

> From: Cheryl Scott <[hidden email]>
> Subject: [SPSSX-L] I have a long string variable (62 chars) with embedded              underscore              characters.  Sample data:
> To: [hidden email]
> Date: Tuesday, October 20, 2009, 12:06 AM
>
>
>
>
> I have a long string variable (62 chars) with embedded
> underscore characters.  Sample data:
>
> THTR105_THTR205______
>
> ELEC101_ELEC101_ELEC151_____
>
> IRW101_IRW101_IRW151_IRW201_IRW201___
>
>
> I want to retain the underscore within the string but
> remove all trailing occurrences of the string.  Here
> is what I wrote:
>
> * remove trailing underscore.
> string newvar (a62).
> compute newvar = rtrim(oldvar, '_').
>
> The syntax does not generate an error message.
> It just runs, but the new variable still has the trailing
> underscores.  Any assistance would be appreciated.
>
>
>
> Cheryl Scott
> IR Data Manager
> TMCC Integrate Implementation
> Team
> Office of Institutional
> Research
> Truckee Meadows Community College
> [hidden email]
> (775)673-8239 (w)
>
>

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Can't see some Multiple Response Sets in Custom Tables

John F Hall
In reply to this post by Mike Pritchard
Forget Analyze, stick to direct syntax.
----- Original Message -----
Sent: Tuesday, October 20, 2009 10:13 PM
Subject: Can't see some Multiple Response Sets in Custom Tables


I've created several different multiple response sets with Analyze | Tables
| Multiple Response sets.  Some of them are visible when I create custom
tables with the Dialog, but others aren't and I can't figure out why.

I finally tried modifying  existing syntax to make a start, and this seems
to work.  But I'd rather see the Mult Resp Set in the dialog box so I can
easily mess around with the categories and subtotals.

What am I missing?  I'm guessing it is just a dumb thing I'm doing.  I'm
using SPSS V16

Thanks
Mike

_________________________________________________________________________
Mike Pritchard | [hidden email] | 5 Circles Research | 425-444-3410

=====================
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: I have a long string variable (62 chars) with embedded underscore characters. Sample data:

Bruce Weaver
Administrator
In reply to this post by Bud Bliss
Bud Bliss wrote
I think the problem here is the trailing characters aren't just blanks, but I don't have anything to show what they are. Might be safer to do a substring from the left up to a double underscore "__", assuming that a double underscore never occurs within the string of interest!
But the underscore does occur within the string of interest.

> I have a long string variable (62 chars) with embedded
> underscore characters.  Sample data:
>
> THTR105_THTR205______
> ELEC101_ELEC101_ELEC151_____
> IRW101_IRW101_IRW151_IRW201_IRW201___
>
> I want to retain the underscore within the string but
> remove all trailing occurrences of the string.  Here...

--
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/).
Reply | Threaded
Open this post in threaded view
|

Re: I have a long string variable (62 chars) with embedded underscore characters. Sample data:

Peck, Jon
Change the format of the variable in question to ahex.
format x(ahexnn).
where nn is 2 x string width.
Then those nonprinting characters will display as hex codes in the DE.  For example,
20 = blank  = 32 decimal
09 = tab = 09 decimal
0A = line feed = 10 decimal
0D = carriage return = 13 decimal

This will tell you what you have.

Then you can get rid of these characters - convert them to blanks - with code such as this.
compute strvar = replace(strvar, string(10, pib1),' ').
compute strvar = replace(strvar, string(13, pib1),' ').

HTH,
Jon Peck

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bruce Weaver
Sent: Tuesday, October 20, 2009 3:24 PM
To: [hidden email]
Subject: Re: [SPSSX-L] I have a long string variable (62 chars) with embedded underscore characters. Sample data:

Bud Bliss wrote:
>
> I think the problem here is the trailing characters aren't just blanks,
> but I don't have anything to show what they are. Might be safer to do a
> substring from the left up to a double underscore "__", assuming that a
> double underscore never occurs within the string of interest!
>

But the underscore does occur within the string of interest.

> I have a long string variable (62 chars) with embedded
> underscore characters.  Sample data:
>
> THTR105_THTR205______
> ELEC101_ELEC101_ELEC151_____
> IRW101_IRW101_IRW151_IRW201_IRW201___
>
> I want to retain the underscore within the string but
> remove all trailing occurrences of the string.  Here...



-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."

NOTE:  My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
--
View this message in context: http://www.nabble.com/I-have-a-long-string-variable-%2862-chars%29-with-embedded-underscore-characters.--Sample-data%3A-tp25966562p25982817.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
Reply | Threaded
Open this post in threaded view
|

Re: I have a long string variable (62 chars) with embedded underscore characters. Sample data:

Bud Bliss
In reply to this post by Bruce Weaver
Yes, but NOT a DOUBLE underscore, at least not in the sample provided.

compute newvar EQ substr(oldvar,1,index(oldvar,"__")-1).
exe.

Seems to do the job.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bruce Weaver
Sent: Tuesday, October 20, 2009 2:24 PM
To: [hidden email]
Subject: Re: I have a long string variable (62 chars) with embedded underscore characters. Sample data:

Bud Bliss wrote:
>
> I think the problem here is the trailing characters aren't just blanks,
> but I don't have anything to show what they are. Might be safer to do a
> substring from the left up to a double underscore "__", assuming that a
> double underscore never occurs within the string of interest!
>

But the underscore does occur within the string of interest.

> I have a long string variable (62 chars) with embedded
> underscore characters.  Sample data:
>
> THTR105_THTR205______
> ELEC101_ELEC101_ELEC151_____
> IRW101_IRW101_IRW151_IRW201_IRW201___
>
> I want to retain the underscore within the string but
> remove all trailing occurrences of the string.  Here...



-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."

NOTE:  My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
--
View this message in context: http://www.nabble.com/I-have-a-long-string-variable-%2862-chars%29-with-embedded-underscore-characters.--Sample-data%3A-tp25966562p25982817.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
Reply | Threaded
Open this post in threaded view
|

Re: I have a long string variable (62 chars) with embedded underscore characters. Sample data:

Bruce Weaver
Administrator
Bud Bliss wrote
Yes, but NOT a DOUBLE underscore, at least not in the sample provided.

compute newvar EQ substr(oldvar,1,index(oldvar,"__")-1).
exe.

Seems to do the job.
Sorry, I missed that it was a double-underscore.  But, the method suggested by Albert-Jan (and modified by Richard) does the job too, and it works even if the final string of underscores is only a single underscore.

--
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/).