Creating Single Variable from 2 Non-Overlapping Variables

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

Creating Single Variable from 2 Non-Overlapping Variables

J.D. Haltigan
I believe Bruce W. provided guidance in a Research Gate posting some time ago regarding my query below (which I copied and have on hand) but did not find exactly what I need in searching the list and I am hoping to get confirmation. In brief: I have two variables that measure the same construct. If participant is one age, they get a certain form, if another age, they get a different form (thus two different variables but the same construct). What I want to do is create a new variable in which each case has a value for the construct. Creating the new variable is straightforward for me but I am unsure how to copy the relevant data from each nonoverlapping variable into the new variable. I believe this would be done using the DO IF function but am stuck a bit. To keep it simple, let's say I have x1 and x2 for a set of participants. X1 and X2 do not overlap. I want to create, say, X1X2 so that each case has a value for the intended target construct. Thanks in advance for assistance. JD

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

Re: Creating Single Variable from 2 Non-Overlapping Variables

Art Kendall
What are the ranges of legitimate and missing values for the 2 variables?

Can you post a small set of syntax that shows what you want
e.g., something like

data list list/ Id (f3) Var1 (f2) Var2(f2) Want(f4).
begin data
001 01 01 ????
002 01 88 ????
003 77 22 ????
. . .
end data.
crosstabs tables = var1 by var2/missing=include.





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

Re: Creating Single Variable from 2 Non-Overlapping Variables

Ki Park
Perhaps, the age group variables may be part of it. Yet, it will need a confirmation. Maybe like this? data list list/ Id (f3) Var1 (f2) Var2(f2) age_group(f1) Want(f4). begin data 001 01 . 1 ???? 002 01 . 1 ???? 003 . 02 2 ???? 004 03 . 1 ???? 005 01 . 1 ???? 006 . 01 2 ???? . . . end data. crosstabs tables = var1 by var2/missing=include.

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

Re: Creating Single Variable from 2 Non-Overlapping Variables

Ki Park
Sorry, it went with a terrible formatting. My apologies.

Perhaps, the age group variables may be part of it. Yet, it will need a
confirmation. Maybe like this?
data list list/ Id (f3) Var1 (f2) Var2(f2) age_group(f1) Want(f4).
begin data
001 01 . 1 ????
002 01 . 1 ????
003 . 02 2 ????
004 03 . 1 ????
005 01 . 1 ????
006 . 01 2 ????
 . . .
end data.
crosstabs tables = var1 by var2/missing=include.



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

Re: Creating Single Variable from 2 Non-Overlapping Variables

David Marso-2
In reply to this post by J.D. Haltigan
FFS, Show us a simple mock-up of what you are after.

=====================
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: Creating Single Variable from 2 Non-Overlapping Variables

John F Hall
In reply to this post by J.D. Haltigan

We need an example for at least one case.  What is X1, what is X2 and what do you want X1X2 to look like?

 

DO IF (X1 GT 0) X1X2= X1.

ELSE IF (X2 GT 0) X1X2 = X2.

END IF.

 

John F Hall  MA (Cantab) Dip Ed (Dunelm)

[Retired academic survey researcher]

 

Email:          [hidden email]

Website:     Journeys in Survey Research

Course:       Survey Analysis Workshop (SPSS)

Research:   Subjective Social Indicators (Quality of Life)

 

From: SPSSX(r) Discussion <[hidden email]> On Behalf Of J.D. Haltigan
Sent: 11 October 2018 11:48
To: [hidden email]
Subject: Creating Single Variable from 2 Non-Overlapping Variables

 

I believe Bruce W. provided guidance in a Research Gate posting some time ago regarding my query below (which I copied and have on hand) but did not find exactly what I need in searching the list and I am hoping to get confirmation. In brief: I have two variables that measure the same construct. If participant is one age, they get a certain form, if another age, they get a different form (thus two different variables but the same construct). What I want to do is create a new variable in which each case has a value for the construct. Creating the new variable is straightforward for me but I am unsure how to copy the relevant data from each nonoverlapping variable into the new variable. I believe this would be done using the DO IF function but am stuck a bit. To keep it simple, let's say I have x1 and x2 for a set of participants. X1 and X2 do not overlap. I want to create, say, X1X2 so that each case has a value for the intended target construct. Thanks in advance for assistance. JD


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: Creating Single Variable from 2 Non-Overlapping Variables

Rich Ulrich
In reply to this post by J.D. Haltigan
If they are non-overlapping -- meaning that one is always missing --
you can create the new variable by a simple Compute where you take
the average while only requiring one to be present.

COMPUTE new= mean.1(var1, var2).

If, by chance, both can be present for some weird future case, the mean is
probably what you want in that instance. So this gives it to you.

--
Rich Ulrich

From: SPSSX(r) Discussion <[hidden email]> on behalf of J.D. Haltigan <[hidden email]>
Sent: Thursday, October 11, 2018 5:48 AM
To: [hidden email]
Subject: Creating Single Variable from 2 Non-Overlapping Variables
 
I believe Bruce W. provided guidance in a Research Gate posting some time ago regarding my query below (which I copied and have on hand) but did not find exactly what I need in searching the list and I am hoping to get confirmation. In brief: I have two variables that measure the same construct. If participant is one age, they get a certain form, if another age, they get a different form (thus two different variables but the same construct). What I want to do is create a new variable in which each case has a value for the construct. Creating the new variable is straightforward for me but I am unsure how to copy the relevant data from each nonoverlapping variable into the new variable. I believe this would be done using the DO IF function but am stuck a bit. To keep it simple, let's say I have x1 and x2 for a set of participants. X1 and X2 do not overlap. I want to create, say, X1X2 so that each case has a value for the intended target construct. Thanks in advance for assistance. JD

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