Search / Replace syntax

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

Search / Replace syntax

Mark Webb-5
   I have a string variable containing brand names ending with a +. If
there is no brand there is still a +.
I want to remove the + when there is NO brand name.
Example - I have -
Record Brand
1             Abc+
2             +
3             Xyz+
I want -
1             Abc+
2
3             Xyz+

I can do this in data view - edit/replace/entire cell......
I looked for the syntax in the log but it does not register.
Is there search/replace/entire cell syntax available as the data view
version needs to be done 1 variable at a time & I have many variables?
Looked at the Replace String Function but can't get the "entire cell"
option I require.
Any suggestions?

--
Mark Webb

Line +27 (21) 786 4379
Cell +27 (72) 199 1000
Fax to email +27 (86) 5513075
Skype  webbmark
Email  [hidden email]

=====================
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: Search / Replace syntax

Art Kendall
  something like this untested syntax should do it.

string newbrand (a4).
do if substr(brand,1,1) eq '+'.
compute newbrand = ''.
else.
compute newbrand=brand.
end if.
crosstabs tables= brand by newbrand.

Art Kendall
Social Research Consultants


On 10/3/2010 2:43 AM, Mark Webb wrote:

>   I have a string variable containing brand names ending with a +. If
> there is no brand there is still a +.
> I want to remove the + when there is NO brand name.
> Example - I have -
> Record Brand
> 1             Abc+
> 2             +
> 3             Xyz+
> I want -
> 1             Abc+
> 2
> 3             Xyz+
>
> I can do this in data view - edit/replace/entire cell......
> I looked for the syntax in the log but it does not register.
> Is there search/replace/entire cell syntax available as the data view
> version needs to be done 1 variable at a time & I have many variables?
> Looked at the Replace String Function but can't get the "entire cell"
> option I require.
> Any suggestions?
>
> --
> Mark Webb
>
> Line +27 (21) 786 4379
> Cell +27 (72) 199 1000
> Fax to email +27 (86) 5513075
> Skype  webbmark
> Email  [hidden email]
>
> =====================
> 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
Art Kendall
Social Research Consultants