Conditional "Add Value Labels"

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

Conditional "Add Value Labels"

SUBSCRIBE SPSSX-JohnF
Does anyone know if it is possible to use, e.g., a "Do If" statement to apply an "Add Value Label"?  

I've done some checking and I think the answer is "NO".

=====================
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: Conditional "Add Value Labels"

Rick Oliver
What is the use case for a "conditional" value label? Value labels are metadata that apply to variables, not individual cases. Defined value labels can exist in the metadata without any cases that have the values associated with those labels. Do you want to limit the set of defined value labels by testing for the presence of each possible value? Do you want the value of the label for variable x to be contingent on the value(s) of one or more other variables?

On Mon, Dec 17, 2018 at 12:00 PM Jon Peck <[hidden email]> wrote:
Metadata commands such as ADD VALUE LABELS are executed out  of order - as soon as they are seen, so a DO IF loop would have no effect.  And since DO IF would be evaluated for every case, it isn't obvious what the logic is here.

A macro could express a conditional, but the conditional could not reference the case data.

You could accomplish this with a little bit of Python code, but you can't submit a command from within a case loop, so you would need to save up the commands and run them after the data pass is done.

If you would explain the goal further, we could find a solution.

On Mon, Dec 17, 2018 at 8:10 AM Mario Giesel <[hidden email]> wrote:
Within an SPSS macro it is possible.

!IF (...) !THEN ... !ELSE ... !IFEND

Mario Giesel
Munich, Germany


Am Montag, 17. Dezember 2018, 15:31:41 MEZ hat SUBSCRIBE SPSSX-JohnF <[hidden email]> Folgendes geschrieben:


Does anyone know if it is possible to use, e.g., a "Do If" statement to apply an "Add Value Label"? 

I've done some checking and I think the answer is "NO".

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


--
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
===================== 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: Conditional "Add Value Labels"

SUBSCRIBE SPSSX-JohnF
In reply to this post by SUBSCRIBE SPSSX-JohnF
I have a list of value labels representing the 3,100+ (2 digit State fips codes combined with a 3 digit county fips code)counties in the United States.  Those labels are already applied.  In processing the data I generate a fipscode representing the a State total which the 2 digit State fips combined with 999.  So I was just thinking about having code which ID's any fipscode ending in 999 and doing add value label of "State Total".  I realize I can always create 52 applicable "999" fipscodes and add them into the original 3,100+ codes.

=====================
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: Conditional "Add Value Labels"

Jon Peck
I am still puzzled.  It would be easy to generate these labels with a bit of Python code, but where would they go?  I doubt that you would want totals in the same variable as the county code as the values would not be commensurable.

On Tue, Dec 18, 2018 at 2:47 PM SUBSCRIBE SPSSX-JohnF <[hidden email]> wrote:
I have a list of value labels representing the 3,100+ (2 digit State fips codes combined with a 3 digit county fips code)counties in the United States.  Those labels are already applied.  In processing the data I generate a fipscode representing the a State total which the 2 digit State fips combined with 999.  So I was just thinking about having code which ID's any fipscode ending in 999 and doing add value label of "State Total".  I realize I can always create 52 applicable "999" fipscodes and add them into the original 3,100+ codes.

=====================
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: Conditional "Add Value Labels"

Art Kendall
If you will be creating state totals via AGGREGATE, CTABLES, or some other
procedure and do not have a FIPSState variable you can easily create a
FIPSState variable by TRUNC if the data is numeric or by CHAR.SBSTR.

Please give more detail about what you are trying to accomplish.

If there is already a variable that mixes together different levels of
analysis there are ways to move the State levels to another variable for
every county.



-----
Art Kendall
Social Research Consultants
--
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
Art Kendall
Social Research Consultants