Stata 15 help for note

[D] notes -- Place notes in data

Syntax

Attach notes to dataset

notes [evarname]: text

List all notes

notes

List specific notes

notes [list] evarlist [in #[/#]]

Search for a text string across all notes in all variables and _dta

notes search [sometext]

Replace a note

notes replace evarname in # : text

Drop notes

notes drop evarlist [in #[/#]]

Renumber notes

notes renumber evarname

where evarname is _dta or a varname, evarlist is a varlist that may contain _dta, and # is a number or the letter l.

If text includes the letters TS surrounded by blanks, the TS is removed, and a time stamp is substituted in its place.

Menu

notes (add)

Data > Variables Manager

notes list and notes search

Data > Data utilities > Notes utilities > List or search notes

notes replace

Data > Variables Manager

notes drop

Data > Variables Manager

notes renumber

Data > Data utilities > Notes utilities > Renumber notes

Description

notes attaches notes to the dataset in memory. These notes become a part of the dataset and are saved when the dataset is saved and retrieved when the dataset is used; see [D] save and [D] use. notes can be attached generically to the dataset or specifically to a variable within the dataset.

How notes are numbered

Notes are numbered sequentially, with the first note being 1. Say variable myvar has four notes numbered 1, 2, 3, and 4. If you type notes drop myvar in 3, the remaining notes will be numbered 1, 2, and 4. If you now add another note, it will be numbered 5. That is, notes are not renumbered and new notes are added immediately after the highest numbered note. Thus, if you now dropped notes 4 and 5, the next note added would be 3.

You can renumber notes by using notes renumber. Going back to when myvar had notes numbered 1, 2, and 4 after dropping note 3, if you typed notes renumber myvar, the notes would be renumbered 1, 2, and 3. If you added a new note after that, it would be numbered 4.

Examples

--------------------------------------------------------------------------- Setup . webuse auto4

Add a note to dataset . note: Send copy to Bob once verified.

List all notes . notes _dta: 1. Send copy to Bob once verified.

Add second note to dataset . note: Mary wants a copy, too.

List all notes . notes _dta: 1. Send copy to Bob once verified. 2. Mary wants a copy, too.

Add third note to dataset and include a time stamp . note: TS merged updates from JJ&F

List all notes . notes _dta: 1. Send copy to Bob once verified. 2. Mary wants a copy, too. 3. 19 Apr 2007 15:38 merged updates from JJ&F

Add two notes to mpg variable . note mpg: is the 41 a mistake? Ask Bob. . note mpg: what about the two missing values?

Search for Bob across notes in all variables and _dta . notes search Bob _dta: 1. Send copy to Bob once verified. mpg: 1. is the 41 a mistake? Ask Bob.

List all notes . notes _dta: 1. Send copy to Bob once verified. 2. Mary wants a copy, too. 3. 19 Apr 2007 15:38 merged updates from JJ&F mpg: 1. is the 41 a mistake? Ask Bob. 2. what about the two missing values?

--------------------------------------------------------------------------- Setup . sysuse auto

Add note to dataset containing a SMCL directive . note: check reason for missing values in {cmd:rep78}

List all notes . notes _dta: 1. from Consumer Reports with permission 2. check reason for missing values in rep78 ---------------------------------------------------------------------------

Video example

How to add notes to a variable


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