apply dictionary

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

apply dictionary

David Lindsay-3
I have a large number of variables v1 to v100 and have created
a number of new variables nv1 to nv100 and I want to give the
new variables the value and variable labels of the old variables.
I had hoped the solution was to create a DO REPEAT with apply
dictionary but it does not work.
I would welcome some suggestions. I am working with V13

Thanks for your help
--
David Lindsay

+44 118 940 3086
+44 7939 126 206 (mobile)
Reply | Threaded
Open this post in threaded view
|

Re: apply dictionary

Albert-Jan Roskam
Hi David,

Perhaps the following would work. Must say I've never
used APPLY DICTIONARY myself.

do repeat #old = v1 to v100 / #new = nv1 to nv100
compute #new = #old.
end repeat print.
save outfile = "c:\temp\source.sav"
   / keep =nv1 to nv100.
get file = "c:\temp\your_target_file.sav".
apply dictionary from = "c:\temp\source.sav".
save outfile = "c:\temp\your_target_file2.sav".
erase file = "c:\temp\source.sav".

Cheers!!
Albert-Jan

--- David Lindsay <[hidden email]>
wrote:

> I have a large number of variables v1 to v100 and
> have created
> a number of new variables nv1 to nv100 and I want to
> give the
> new variables the value and variable labels of the
> old variables.
> I had hoped the solution was to create a DO REPEAT
> with apply
> dictionary but it does not work.
> I would welcome some suggestions. I am working with
> V13
>
> Thanks for your help
> --
> David Lindsay
>
> +44 118 940 3086
> +44 7939 126 206 (mobile)
>


Cheers!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Did you know that 87.166253% of all statistics claim a precision of results that is not justified by the method employed? [HELMUT RICHTER]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/
Reply | Threaded
Open this post in threaded view
|

Re: apply dictionary

Daniel E WILLIAMS
In reply to this post by David Lindsay-3
This sounds like a case for automatic code generation.  You can use the
arcane macro syntax, or better, the SPSS-Python interface to do this.
The SPSS-Python integration package is free for v13 from the SPSS
website.

Dan Williams
Forecasting, Research and Analysis Office
Department of Human Services
State of Oregon, USA
503 947 5354

>>> "David Lindsay" <[hidden email]> 3/26/2007 10:27 AM
>>>

I have a large number of variables v1 to v100 and have created
a number of new variables nv1 to nv100 and I want to give the
new variables the value and variable labels of the old variables.
I had hoped the solution was to create a DO REPEAT with apply
dictionary but it does not work.
I would welcome some suggestions. I am working with V13

Thanks for your help
--
David Lindsay

+44 118 940 3086
+44 7939 126 206 (mobile)
Reply | Threaded
Open this post in threaded view
|

Re: apply dictionary

Richard Ristow
At 12:23 PM 3/27/2007, Daniel E WILLIAMS wrote:

>You can use the SPSS-Python interface to do this. The SPSS-Python
>integration package is free for v13 from the SPSS website.

Free if it existed, but unfortunately it doesn't. Python was added in
SPSS 14. The modules for 14 and 15 *are* free from the SPSS website.