Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Copy value labels in syntax

13,077 views
Skip to first unread message

Filip Van Droogenbroeck

unread,
Apr 14, 2010, 4:43:07 AM4/14/10
to
Dear reader,

Is it possible to copy the value labels of a variable to another
variable through the syntax?
So for example
variable Emotions with value labels 1 "Happy" 2 "Sad" 3 "Joy".
how do I copy these value labels to the variable Universalemotions
through the syntax.
I know it's possible through copy pasting but I'm wondering if there
is a syntax way to do it, should be available and simple but can't
find it in the help files...

thank you very much,
Kind regards,
Filip Van Droogenbroeck

Bruce Weaver

unread,
Apr 14, 2010, 8:33:16 AM4/14/10
to
On Apr 14, 4:43 am, Filip Van Droogenbroeck


Does item 6 here do what you want?

www.spsstools.net/SampleSyntax.htm#LabelsAndVariableNames

--
Bruce Weaver
bwe...@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/Home
"When all else fails, RTFM."

JKPeck

unread,
Apr 14, 2010, 9:08:21 AM4/14/10
to
On Apr 14, 6:33 am, Bruce Weaver <bwea...@lakeheadu.ca> wrote:
> On Apr 14, 4:43 am, Filip Van Droogenbroeck
>
>
>
> <filip.van.droogenbro...@gmail.com> wrote:
> > Dear reader,
>
> > Is it possible to copy the value labels of a variable to another
> > variable through the syntax?
> > So for example
> > variable Emotions with value labels 1 "Happy" 2 "Sad" 3 "Joy".
> > how do I copy these value labels to the variable Universalemotions
> > through the syntax.
> >  I know it's possible through copy pasting but I'm wondering if there
> > is a syntax way to do it, should be available and simple but can't
> > find it in the help files...
>
> > thank you very much,
> > Kind regards,
> > Filip Van Droogenbroeck
>
> Does item 6 here do what you want?
>
>  www.spsstools.net/SampleSyntax.htm#LabelsAndVariableNames
>
> --
> Bruce Weaver
> bwea...@lakeheadu.cahttp://sites.google.com/a/lakeheadu.ca/bweaver/Home

> "When all else fails, RTFM."

You can do this with APPLY DICTIONARY (aka Data>Copy Data Properties)

Regards,
Jon Peck

Bruce Weaver

unread,
Apr 14, 2010, 9:48:11 AM4/14/10
to


Thanks Jon. Here is an example from the Help file:

APPLY DICTIONARY from *
/SOURCE VARIABLES = var1
/TARGET VARIABLES = var2 var3 var4
/NEWVARS.

• Variable definition attributes for var1 in the active dataset are
copied to var2, var3, and var4 in the same dataset if they have a
matching type.

• Any variables specified in the TARGET subcommand that do not already
exist are created, using the variable definition attributes of the
variable specified in the SOURCE subcommand.

Am I correct in thinking that APPLY DICTIONARY did not always have
this capability? Presumably, Raynald would not have written his macro
if he could have done this.

--
Bruce Weaver
bwe...@lakeheadu.ca

JKPeck

unread,
Apr 14, 2010, 12:14:53 PM4/14/10
to

The original APPLY DICTIONARY command was much more rigid, but it was
reworked sometime around version 14.
Note that the command allows you to just copy value labels by
specifying /VARINFO VALLABELS=MERGE or REPLACE.

-Jon

Filip Van Droogenbroeck

unread,
Apr 16, 2010, 7:46:57 AM4/16/10
to
Thank you very much!
Apply dictionary does the trick.

decicc...@gmail.com

unread,
Sep 30, 2013, 10:12:38 AM9/30/13
to
> You can do this with APPLY DICTIONARY (aka Data>Copy Data Properties)
>
> Regards,
> Jon Peck

Thank you very much!

Barry

federi...@gmail.com

unread,
Oct 27, 2014, 8:55:24 AM10/27/14
to
what if I have to merge many variables (with different value codes) into one?

i tried applying dictionary sequentially but every iteration replaces all value labels instead of just adding the new ones.

David Marso

unread,
Oct 27, 2014, 11:53:33 AM10/27/14
to
On Monday, October 27, 2014 8:55:24 AM UTC-4, federi...@gmail.com wrote:
> what if I have to merge many variables (with different value codes) into one?
>
> i tried applying dictionary sequentially but every iteration replaces all value labels instead of just adding the new ones.

Look at the VARINFO VALLABELS subcommand for APPLY DICTIONARY.
What does the documentation suggest that you do to resolve this?
0 new messages