loop to remove variable labels?

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

loop to remove variable labels?

Jeff6610

 

I’m trying to do something similar to the following to remove the variable labels from several variables but the Variable Labels command doesn’t work inside of this type of loop.

 

Do repeat x = w y z .

  Variable Labels x “” .

End repeat.

 

What can I do instead?

 

Thanks in advance.

 

Jeff

 

 

===================== 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: loop to remove variable labels?

Bruce Weaver
Administrator
From the archives of this list
(http://spssx-discussion.1045642.n5.nabble.com/Syntax-to-remove-Value-Labels-tp5729003p5729007.html):

--- start of old post ---
VALUE LABELS varlist.
declares that there are no value labels for any listed variable.  The listed
variables should all be of the same type (string or numeric).

Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
--- end of old post ---

In light of that, try the following:

VARIABLE LABELS w y z.




Jeff6610 wrote

> I'm trying to do something similar to the following to remove the variable
> labels from several variables but the Variable Labels command doesn't work
> inside of this type of loop.
>
>  
>
> Do repeat x = w y z .
>
>   Variable Labels x "" .
>
> End repeat.
>
>  
>
> What can I do instead?
>
>  
>
> Thanks in advance.
>
>  
>
> Jeff
>
>  
>
>  
>
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





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

--
Sent from: http://spssx-discussion.1045642.n5.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
--
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: loop to remove variable labels?

Jon Peck
I don't think that works.  Variable labels are expected to be unique, so the command only allows one at a time.  A short Python program or even a macro loop (gasp) would handle this.

On Sat, Sep 22, 2018 at 6:58 AM Bruce Weaver <[hidden email]> wrote:
From the archives of this list
(http://spssx-discussion.1045642.n5.nabble.com/Syntax-to-remove-Value-Labels-tp5729003p5729007.html):

--- start of old post ---
VALUE LABELS varlist.
declares that there are no value labels for any listed variable.  The listed
variables should all be of the same type (string or numeric).

Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
--- end of old post ---

In light of that, try the following:

VARIABLE LABELS w y z.




Jeff6610 wrote
> I'm trying to do something similar to the following to remove the variable
> labels from several variables but the Variable Labels command doesn't work
> inside of this type of loop.
>

>
> Do repeat x = w y z .
>
>   Variable Labels x "" .
>
> End repeat.
>

>
> What can I do instead?
>

>
> Thanks in advance.
>

>
> Jeff
>

>

>
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





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

--
Sent from: http://spssx-discussion.1045642.n5.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
--
Jon K Peck
[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: loop to remove variable labels?

Bruce Weaver
Administrator
As you might have guessed, Jon, a macro was my first thought.  Something like
this (untested).

* Define a macro to drop variable labels for a list of variables.
DEFINE !DropVarLabs ( vlist = !CMDEND ).
!DO !v !IN (!vlist)
VARIABLE LABELS !v.
!DOEND
!ENDDEFINE.

* Call the macro.
!DropVarLabs vlist = w y z.




Jon Peck wrote
> I don't think that works.  Variable labels are expected to be unique, so
> the command only allows one at a time.  A short Python program or even a
> macro loop (gasp) would handle this.
>
> On Sat, Sep 22, 2018 at 6:58 AM Bruce Weaver &lt;

> bruce.weaver@

> &gt;
> wrote:
>
>> From the archives of this list
>> (
>> http://spssx-discussion.1045642.n5.nabble.com/Syntax-to-remove-Value-Labels-tp5729003p5729007.html
>> ):
>>
>> --- start of old post ---
>> VALUE LABELS varlist.
>> declares that there are no value labels for any listed variable.  The
>> listed
>> variables should all be of the same type (string or numeric).
>>
>> Jon Peck (no "h") aka Kim
>> Senior Software Engineer, IBM
>> --- end of old post ---
>>
>> In light of that, try the following:
>>
>> VARIABLE LABELS w y z.
>
> --- snip ---





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

--
Sent from: http://spssx-discussion.1045642.n5.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
--
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/).