Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: Knowing how a variable was generated
From
Louis Boakye-Yiadom <[email protected]>
To
[email protected]
Subject
RE: st: Knowing how a variable was generated
Date
Tue, 2 Nov 2010 18:23:09 +0000 (GMT)
George, thanks.
Louis
--- On Tue, 2/11/10, Hoffman, George <[email protected]> wrote:
> From: Hoffman, George <[email protected]>
> Subject: RE: st: Knowing how a variable was generated
> To: "[email protected]" <[email protected]>
> Date: Tuesday, 2 November, 2010, 13:35
> Take a look at 'defv' (define
> variable) user-written command.
>
> STB-51 dm50.1 . . . . . . . . . . . . . . . . .
> . . . . . . . Update to defv
> (help defv if installed)
> . . . . . . . . . . . . . . . J. R. Gleason
> 9/99 p.2; STB
> Reprints Vol 9, pp.14--15
> updated to Stata 6 and
> improved
>
> use 'findit defv' to get it over the web.
>
> You can use it in place of generate or replace to recode a
> note for each variable definition step.
>
> As an example:
>
>
> . set obs 10
> obs was 0, now 10
>
> . defv x = _n
>
> . defv x = x^x
> (9 real changes made)
>
> . defv x = _n
> (9 real changes made)
>
> . defv y = x^2
>
> . notes
>
> x:
> 1. generate x = _n
> 2. replace x = x^x
> 3. replace x = _n
>
> y:
> 1. generate y = x^2
>
> . list
>
> +----------+
> | x
> y |
> |----------|
> 1. | 1 1 |
> 2. | 2 4 |
> 3. | 3 9 |
> 4. | 4 16 |
> 5. | 5 25 |
> |----------|
> 6. | 6 36 |
> 7. | 7 49 |
> 8. | 8 64 |
> 9. | 9 81 |
> 10. | 10 100 |
> +----------+
>
> .
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]
> On Behalf Of Louis Boakye-Yiadom
> Sent: Tuesday, November 02, 2010 2:55 AM
> To: [email protected]
> Subject: Re: st: Knowing how a variable was generated
>
> Allan, thanks.
>
> Louis
>
> --- On Mon, 1/11/10, Allan Reese (Cefas) <[email protected]>
> wrote:
>
> > From: Allan Reese (Cefas) <[email protected]>
> > Subject: Re: st: Knowing how a variable was generated
> > To: [email protected]
> > Date: Monday, 1 November, 2010, 17:25
> > "If some of the variables in a
> > dataset were generated by a
> > transformation or combination of some other
> variable(s) in
> > the data, is
> > it possible to know this without seeing the relevant
> log or
> > do file?"
> >
> > It would be possible for software to record "created"
> and
> > "last
> > modified" dates for each variable, but it doesn't.
> It
> > seems rather
> > onerous to record the complete history: a variable
> might be
> > generated,
> > subsequently recoded or specified values replaced
> (with if
> > or in), or
> > edited as individual values (each of which creates a
> > replace for that
> > unit. It is unsafe to rely on the user having
> > recorded all actions in
> > the label.
> >
> > That is why I have advocated having a profile.do that
> > creates a daily
> > log file so that all user commands are captured,
> including
> > those created
> > by edits. I have hundreds of text files
> logYYYY-MM-DD.txt.
> >
> >
> > * Sprinkle with comments as it is otherwise hard,
> weeks
> > later, to work
> > out *why* you wrote specific commands, and of course
> the
> > log contains
> > all mistakes and blind alleys as well as the yellow
> brick
> > road to
> > happiness.
> >
> > I regularly remind myself how variables came about by
> > searching the logs
> > for variable or file names. The one operation that
> > creates no log is
> > pasting data from an arbitrary range of an Excel
> > spreadsheet. That needs
> > a comment, then wash you hands.
> >
> > Allan
> >
> >
> >
> ***********************************************************************************
> > This email and any attachments are intended for the
> named
> > recipient only. Its unauthorised use, distribution,
> > disclosure, storage or copying is not permitted. If
> > you have received it in error, please destroy all
> copies and
> > notify the sender. In messages of a non-business
> > nature, the views and opinions expressed are the
> author's
> > own and do not necessarily reflect those of the
> organisation
> > from which it is sent. All emails may be subject to
> > monitoring.
> >
> ***********************************************************************************
> >
> >
> > *
> > * 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/
> >
>
>
>
>
> *
> * 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/
>
> *
> * 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/
>
*
* 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/