That would get values into NEWVAR2 where values exist in VAR2. Would you
not need to then add
if missing(newvar2) newvar2 = lag(newvar2) .
In cases where NEWVAR2 is missing, this would copy the value in the
previous case into the current case. As far as I'm aware, this would only
fail where NEWVAR2 has a missing value in the first record in the data -
there being no LAG record to copy from.
******************************************************************
Steven Hope
NFO Social Research
19 Atholl Crescent
Edinburgh, EH3 8HQ
t. 0131-656 4035
f. 0131-656 4001
switchboard - 0131-656 4000
NFO Social Research is a division of NFO WorldGroup
******************************************************************
The information in this e-mail and any attachments is confidential.
It is intended only for the named recipient(s). If you are not the
named recipient please notify the sender immediately and do not
disclose the contents to another person or take copies.
Job number:
On Tuesday, February 04, 2003 3:28 PM, Arthur J. Kendall
[SMTP:[log in to unmask]] wrote:
> It sounds like you may be looking for LEAVE or LAG.
>
> Or you may mean something like this:
> do if missing(var2).
> recode var1(1 thru 7 = 1)(18,33,92=2)(else = copy) into newvar2.
> else.
> recode var2(else=copy)into newvar2.
> end if.
> execute.
>
> recode is very powerful. to see the command syntax for any command type
> it into a syntax window highlight it and click the command syntax icon
> on the tool bar [looks like a small outline).
>
> In order to facilitate quality assurance review, to help in learning
> syntax, and to preserve syntax so you can as you develop your process by
> successive approximations, it is a good habit to use the <paste> button
> to exit menus instead of the <ok> button,
>
>
> Does this do what you want? If not please restate your question in more
> detail.
>
>
> Art
> [log in to unmask]
> Social Research Consultants
> University Park, MD USA
> (301) 864-5570
>
>
> Karen Snape wrote:
> > Hi Allstaters
> >
> > Does anyone know the SPSS function equivalent to the "retain" statement
in
> > SAS?
> >
> > I want to create a new variable from an existing variable and copy the
> > results down the rows (over missing values) until the next valid row.
> >
> > Thanks in advance
> > Karen Snape
> >
>
|