-
Notifications
You must be signed in to change notification settings - Fork 6
/
pip_drop.ado
76 lines (56 loc) · 1.7 KB
/
pip_drop.ado
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
73
74
75
76
/*==================================================
project:
Author: R.Andres Castaneda
----------------------------------------------------
Creation Date: 20 Jan 2022 - 09:44:03
==================================================*/
/*==================================================
0: Program set up
==================================================*/
program define pip_drop, rclass
syntax [anything(name=subcommand)], [frame_prefix(string) qui]
qui {
//========================================================
// Frames
//========================================================
if regexm("`subcommand'", "^frame") {
if ("`frame_prefix'" == "") {
local frame_prefix "pip_"
}
//------------ Remove frames
frame dir
local av_frames "`r(frames)'"
foreach fr of local av_frames {
if (regexm("`fr'", "(^`frame_prefix')(.+)")) {
frame drop `fr'
local dropped "`dropped' `fr'"
}
} // loop over frames
if ("`dropped'" == "") {
if ("`qui'" == "") noi disp in y "NO frame was dropped"
}
else {
if ("`qui'" == "") {
noi disp in y "The following internal frames were dropped:"
foreach f of local dropped {
noi disp in w "`f'"
}
}
}
}
//========================================================
// Globals
//========================================================
if regexm("`subcommand'", "^global") {
local pip_globals: all globals "pip_*"
* disp "`pip_globals'"
foreach gl of local pip_globals {
if regexm("`gl'", "svr") continue
global `gl' ""
}
}
} // end of qui
end
exit
/* End of do-file */
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><