Date: Mon, 21 Feb 2011 10:08:29 -0800
Reply-To: Bruce Weaver <bruce.weaver@hotmail.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Bruce Weaver <bruce.weaver@hotmail.com>
Subject: Re: Selecting the rightmost variable of several columns
In-Reply-To: <1298307151449-3394411.post@n5.nabble.com>
Content-Type: text/plain; charset=us-ascii
rmjdgeh wrote:
>
> Dear list,
>
> Does anyone know how I can select value from the "rightmost" of a set of
> columns?
>
> For example, each column might represent the same variable measured in
> different years. I want to select the most recent information, because the
> value might be missing for the current year.
>
> Many thanks,
> Gareth
>
If I follow, you want to do something like this.
* Read in some sample data.
data list / v1 to v3 1-3 .
begin data.
1
2
3
12
23
123
end data.
* Pick out right-most valid value.
numeric rigthmost (f2.0).
do repeat v = v1 to v3.
- if not missing(v) rightmost = v.
end repeat.
list.
HTH.
-----
--
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.
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Selecting-the-rightmost-variable-of-several-columns-tp3394411p3394510.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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