Hello to all. Maybe this is a very dumb question, but I was looked around and I'm still unable to solve this problem. Is it possible to "duplicate" (to make a identical copy of a variable with a differente name) by syntax.
Thanks to all |
Administrator
|
If it is a numeric variable (including date or time variables):
COMPUTE NewVar = OldVar. If it is a string variable (and assuming it needs to be 15 characters in length): STRING NewVar(A15). COMPUTE NewVar = OldVar. Replace NewVar and OldVar with your variable names. Change A15 to reflect the length of string variable you need if it is a string. HTH.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
If you want also to copy all the metadata,
look at APPLY DICTIONARY.
Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: Bruce Weaver <[hidden email]> To: [hidden email], Date: 01/21/2014 04:21 PM Subject: Re: [SPSSX-L] Syntax for duplicate variable Sent by: "SPSSX(r) Discussion" <[hidden email]> If it is a numeric variable (including date or time variables): COMPUTE NewVar = OldVar. If it is a string variable (and assuming it needs to be 15 characters in length): STRING NewVar(A15). COMPUTE NewVar = OldVar. Replace NewVar and OldVar with your variable names. Change A15 to reflect the length of string variable you need if it is a string. HTH. Norberto Hernandez wrote > Hello to all. Maybe this is a very dumb question, but I was looked around > and I'm still unable to solve this problem. Is it possible to "duplicate" > (to make a identical copy of a variable with a differente name) by syntax. > > Thanks to all ----- -- 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. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Syntax-for-duplicate-variable-tp5724055p5724056.html Sent from the SPSSX Discussion mailing list archive at 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 |
Free forum by Nabble | Edit this page |