-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmymean.sthlp
executable file
·72 lines (50 loc) · 1.87 KB
/
mymean.sthlp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{smcl}
{cmd:help mymean}
{hline}
{title:Title} {* section title}
{p2colset 7 15 17 2}{...}
{p2col :{hi:mymean} {hline 2}}Report the mean and generate a variable taking the mean{p_end}
{p2colreset}{...}
{title:Syntax}
{p 6 16 2}
{cmd:mymean} {varlist} {ifin}
[{cmd:,}
{it:options}]
{synoptset 20 tabbed}{...}
{synopthdr}
{synoptline}
{syntab:Options}
{synopt :{opth suf:fix(string)}}manually set the suffix of the new variable;default is _mean{p_end}
{synoptline}
{p2colreset}{...}
{p 4 6 2}
{opt by} is allowed; see {manhelp by D}.
{title:Description}
{pstd}
{cmd:mymean} generates variables based on {varlist} that take the average value.
{cmd:mymean} also reports the average value and returns a matrix of all averages.
{title:Options}
{dlgtab:Options}
{phang}
{opt suffix} optionally specify a string that changes the default suffix (_mean).
{title:Examples}
{pstd}Setup{p_end}
{phang2}{cmd:. sysuse auto}{p_end}
{pstd}Calculate the average for {cmd:weight} and {cmd:length}{p_end}
{phang2}{cmd:. mymean weight length}{p_end}
{pstd}Calculate the average for {cmd:weight} and {cmd:length} seperately for domestic and foreign cars with different suffix.{p_end}
{phang2}{cmd:. bysort foreign: mymean weight length, suffix("_meanf")}{p_end}
{title:Saved results}
{pstd}
{cmd:mymean} saves the following in {cmd:r()}:
{synoptset 15 tabbed}{...}
{p2col 5 15 19 2: Matrices}{p_end}
{synopt:{cmd:r(mean)}}Matrix of average values for all variables of {varlist} and for all groups if {opt by} was used.{p_end}
{synoptset 15 tabbed}{...}
{p2col 5 15 19 2: Macros}{p_end}
{synopt:{cmd:r(grp)}}command to generate a unique group identifier. Usage: {cmd:egen uniqueID = `r(grp)'}{p_end}
{p2colreset}{...}
{title:Also see}
{psee}
Online: {manhelp egen D}, {manhelp summarize R}
{p_end}{* manhelp links the appropriate helpfiles}