-
Notifications
You must be signed in to change notification settings - Fork 2
/
state.ado
106 lines (72 loc) · 3.03 KB
/
state.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*******************************************************************************
* *
* Handles persisting the state of Stata when using xv *
* *
*******************************************************************************/
*! state
*! v 0.0.2
*! 29FEB2024
// Drop program from memory if already loaded
cap prog drop state
// Define program
prog def state, rclass
// Version statement
version 15
// Set a characteristic with the current rng
char _dta[rng] `"`c(rng)'"'
// Return this in the argument named local
ret loc rng = `"`c(rng)'"'
// Set the dataset characteristic for the current RNG in effect
char _dta[rngcurrent] `"`c(rng_current)'"'
// Set the return macro
ret loc rngcurrent = `"`c(rng_current)'"'
// Set the dataset characteristic for the current state of the RNG
char _dta[rngstate] `"`c(rngstate)'"'
// Set the return macro
ret loc rngstate = `"`c(rngstate)'"'
// Set the dataset characteristic for the last set seed for the RNG
char _dta[rngseed] `"`c(rngseed_mt64s)'"'
// Set the return macro
ret loc rngseed = `"`c(rngseed_mt64s)'"'
// Set the dataset characteristic for the current stream of the streaming RNG
char _dta[rngstream] `"`c(rngstream)'"'
// Set the return macro
ret loc rngstream = `"`c(rngstream)'"'
// Set the dataset characteristic for the name of the file in memory
char _dta[filename] `"`c(filename)'"'
// Set the return macro
ret loc filename = `"`c(filename)'"'
// Set the dataset characteristic for the last saved file date
char _dta[filedate] `"`c(filedate)'"'
// Set the return macro
ret loc filedate = `"`c(filedate)'"'
// Set the dataset characteristic for the Stata version
char _dta[version] `"`c(version)'"'
// Set the return macro for it
ret loc version = `"`c(version)'"'
// Set the dataset characteristic for the current date
char _dta[currentdate] `"`c(current_date)'"'
// Set the return macro for it
ret loc currentdate = `"`c(current_date)'"'
// Set the dataset characteristic for the current time
char _dta[currenttime] `"`c(current_time)'"'
// Set the return macro for it
ret loc currenttime = `"`c(current_time)'"'
// Set the dataset characteristic for the stata edition/flavor
char _dta[stflavor] `"`c(edition_real)'"'
// Set the return macro for it
ret loc stflavor = `"`c(edition_real)'"'
// Set the dataset characteristic for the number of processors for use
char _dta[processors] `"`c(processors)'"'
// Set the return macro for it
ret loc processors = `"`c(processors)'"'
// Set the dataset characteristic for the hostname
char _dta[hostname] `"`c(hostname)'"'
// Set the return macro for it
ret loc hostname = `"`c(hostname)'"'
// Set the dataset characteristic for the machine type
char _dta[machinetype] `"`c(machine_type)'"'
// Set the return macro for it
ret loc machinetype = `"`c(machine_type)'"'
// End of program definition
end