Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Generating exact copy of variable


From   "Philipp Rehm" <Philipp.Rehm@gmx.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Generating exact copy of variable
Date   Fri, 15 May 2009 15:55:32 +0200

.
Many thanks to Jeph Herrin and Maarten L. Buis.
-clonevar- is doing exactly what I need.
Thanks,
Philipp 

-------- Original-Nachricht --------
> Datum: Fri, 15 May 2009 09:42:39 -0400
> Von: Jeph Herrin <junk@spandrel.net>
> An: statalist@hsphsun2.harvard.edu
> Betreff: Re: st: Generating exact copy of variable

> 
> See  -help clonevar-
> 
> 
> 
> Philipp Rehm wrote:
> > Dear all,
> > 
> > is there a way to generate an exact copy of a variable? By "exact copy",
> I mean a variable with the same storage type, display format and value
> label. (I can't use -rename- for my problem). I am using Stata/SE 10.1,
> Windows XP.
> > 
> > Below is an example of the problem I ran into.
> > 
> > Many thanks,
> > Philipp
> > 
> > 
> > . gen test_id= id
> > 
> > . compare test_id id
> > 
> >                                         ---------- difference ----------
> >                             count       minimum      average     maximum
> > ------------------------------------------------------------------------
> > test_id<id                 543121          -121    -4.120179          -1
> > test_id=id                  79808
> > test_id>id                 157474             1     19.96243         127
> >                        ----------
> > jointly defined            780403          -121     1.160693         127
> >                        ----------
> > total                      780403
> > 
> > . d test_id id
> > 
> >               storage  display     value
> > variable name   type   format      label      variable label
> >
> -------------------------------------------------------------------------------------------------------------------------------------
> > test_id         float  %9.0g
> > id              double %10.0g                 personal id
> > 
> > . gen double test2_id= id
> > 
> > . compare test2_id id
> > 
> >                                         ---------- difference ----------
> >                             count       minimum      average     maximum
> > ------------------------------------------------------------------------
> > test2_id=id                780403
> >                        ----------
> > jointly defined            780403             0            0           0
> >                        ----------
> > total                      780403
> > 
> > 
> > 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index