Copy/paste values in stacked dataset

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

Copy/paste values in stacked dataset

Oliver
Hi everyone,

I have a multilevel (ie., stacked)  SPSS database with Level 1 and Level 2
variables ? In order to have a "clean/complete" dataset, the same Level 2
values need to be entered across all waves (see picture below). Thanks to
some of you on this forum, a syntax was given to me so that these data can
be copied easily. The syntax is shown below and it works perfectly. The only
problem is that the syntax will not work if a missing value was specified
(eg., -999). If this missing value is specified, the missing value will be
overwritten by the previous set of values. Is there any modification that
could be made to the syntax in order to leave the -999 or any other missing
value ? Thanks in advance !

DO REPEAT v = Age to MaritalStatus.
- IF MISSING(v) v = LAG(v).
END REPEAT.

<http://spssx-discussion.1045642.n5.nabble.com/file/t340718/Image.jpg>





--
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: Copy/paste values in stacked dataset

Bruce Weaver
Administrator
I suspect you did not instruct SPSS to treat -999 as missing.  Try this:

MISSING VALUES Age to MaritalStatus (-999).
DO REPEAT v = Age to MaritalStatus.
- IF MISSING(v) v = LAG(v).
END REPEAT.



Oliver wrote

> Hi everyone,
>
> I have a multilevel (ie., stacked)  SPSS database with Level 1 and Level 2
> variables ? In order to have a "clean/complete" dataset, the same Level 2
> values need to be entered across all waves (see picture below). Thanks to
> some of you on this forum, a syntax was given to me so that these data can
> be copied easily. The syntax is shown below and it works perfectly. The
> only
> problem is that the syntax will not work if a missing value was specified
> (eg., -999). If this missing value is specified, the missing value will be
> overwritten by the previous set of values. Is there any modification that
> could be made to the syntax in order to leave the -999 or any other
> missing
> value ? Thanks in advance !
>
> DO REPEAT v = Age to MaritalStatus.
> - IF MISSING(v) v = LAG(v).
> END REPEAT.
>
> &lt;http://spssx-discussion.1045642.n5.nabble.com/file/t340718/Image.jpg&gt; 
>
>
>
>
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> 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."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
Reply | Threaded
Open this post in threaded view
|

Re: Copy/paste values in stacked dataset

Rich Ulrich
In reply to this post by Oliver
I'm guessing here - You have -999 when data is Missing for Level 1, and you do want to
pick up the data from the previous person.  Your example shows the dot  (".") for system-
missing for your follow up rows.

If that is the problem, then your simple solution is to replace the MISSING( ) function
with the SYSMIS( ) function, so that the LAG( ) is only used within one person.

Else, I don't understand what you are getting at.

--
Rich Ulrich



From: SPSSX(r) Discussion <[hidden email]> on behalf of Oliver <[hidden email]>
Sent: Monday, September 23, 2019 12:12 AM
To: [hidden email] <[hidden email]>
Subject: Copy/paste values in stacked dataset
 
Hi everyone,

I have a multilevel (ie., stacked)  SPSS database with Level 1 and Level 2
variables ? In order to have a "clean/complete" dataset, the same Level 2
values need to be entered across all waves (see picture below). Thanks to
some of you on this forum, a syntax was given to me so that these data can
be copied easily. The syntax is shown below and it works perfectly. The only
problem is that the syntax will not work if a missing value was specified
(eg., -999). If this missing value is specified, the missing value will be
overwritten by the previous set of values. Is there any modification that
could be made to the syntax in order to leave the -999 or any other missing
value ? Thanks in advance !

DO REPEAT v = Age to MaritalStatus.
- IF MISSING(v) v = LAG(v).
END REPEAT.

<http://spssx-discussion.1045642.n5.nabble.com/file/t340718/Image.jpg>





--
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
===================== 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: Copy/paste values in stacked dataset

Oliver
Bruce & Rich,

Thanks to both of you for getting back to me. I was able to achieve what I
want because of your support and codes.

In case this could be useful for other users, I've attached an image of what
I wanted. As can be seen, I wanted values of -999 copied (automatically)
across all waves given that "Age" is a Level 2 variable.

Here's the syntax that solved the problem.

DO REPEAT v = Baseline_Demog_Age.
- IF MISSING(v) v = -999.
END REPEAT.

Thanks again to both of you.
O.

<http://spssx-discussion.1045642.n5.nabble.com/file/t340718/Do_Repeat.jpg>



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