If statements when dealing with multiple values

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

If statements when dealing with multiple values

abommaraju
I'm looking for a simple solution to what seems like a simple problem.
I have a data set that looks like this:

                       

The data comes from a form that is filled out by a medical provider. For each service provided to a patient the provider must check a box on the form that corresponds to a code. Thus, there are multiple values selected in each patient encounter. These multiple values come out of our system in a number of columns as seen above. I want to create a logical test in SPSS that does the following:

If the value in S1, S2, S3, S4, S5, S6, or S7 is equal to 2, 4, 5, 6, 9, 10, 15, or 47 then another variable called STD_Check should be set to 1. If this test is false, then STD_Check should be set to 0.

I think the easiest way to do it would be to make an if statement for each individual column to check for each individual value, but it seems like that is a silly way of approaching this problem.

If anyone could help me with a shortcut to deal with this problem, I would very much appreciate it!

Best,
Aalap Bommaraju
Cincinnati Health Department
Reply | Threaded
Open this post in threaded view
|

Re: If statements when dealing with multiple values

Mark Miller
Can we simplify this ?

COUNT Std_Check = s1 to s7 (2,4,5,6,9,10,15,47).
RECODE  Std_Check (1 THRU HI = 1 ).


... Mark Miller


On Sun, Oct 14, 2012 at 7:00 PM, abommaraju <[hidden email]> wrote:
I'm looking for a simple solution to what seems like a simple problem.
I have a data set that looks like this:
<http://spssx-discussion.1045642.n5.nabble.com/file/n5715640/Untitled.png>


The data comes from a form that is filled out by a medical provider. For
each service provided to a patient the provider must check a box on the form
that corresponds to a code. Thus, there are multiple values selected in each
patient encounter. These multiple values come out of our system in a number
of columns as seen above. I want to create a logical test in SPSS that does
the following:

If the value in S1, S2, S3, S4, S5, S6, or S7 is equal to 2, 4, 5, 6, 9, 10,
15, or 47 then another variable called STD_Check should be set to 1. If this
test is false, then STD_Check should be set to 0.

I think the easiest way to do it would be to make an if statement for each
individual column to check for each individual value, but it seems like that
is a silly way of approaching this problem.

If anyone could help me with a shortcut to deal with this problem, I would
very much appreciate it!

Best,
Aalap Bommaraju
Cincinnati Health Department



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/If-statements-when-dealing-with-multiple-values-tp5715640.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