Hello,
I believe I incorrectly posted this to the Statalist earlier today. I recognize this question is simple but I need help. I try to debug my .do files by examining datasets created within them. So, I want to understand how to create a temporary dataset that exists after completion of a do file but its erased upon Stata exit. I have been unsuccessful at accomplishing this.
I wrote the following simple program as a way to test possibilities.
input firm year
10 2019
10 2018
11 2017
11 2016
end
describe
tempfile nextcit
save "`nextcit'"
global macrot "`nextcit'"
save $macrot, replace
describe
use $macrot
list
[output after describe command]
describe
Contains data from C:\Users\Owner\AppData\Local\Temp\ST_459c_000001.t mp
obs: 4
vars: 2 31 Jan 2019 12:45
size: 32
----------------------------------------------------------------------------------------------------------------
storage display value
variable name type format label variable label
----------------------------------------------------------------------------------------------------------------
firm float %9.0g
year float %9.0g
----------------------------------------------------------------------------------------------------------------
Sorted by:
.
. use $macrot
.
. list
+-------------+
| firm year |
|-------------|
1. | 10 2019 |
2. | 10 2018 |
3. | 11 2017 |
4. | 11 2016 |
+-------------+
-----
However, after my .do file terminates and I type in the command window :
. use $macrot
and receive the following error:
file C:\Users\Owner\AppData\Local\Temp\ST_459c_000001.t mp not found
r(601);
How can I access the data that I intended to store within $macrot?
Thanks in advance for your time and consideration,
Ed
Related Posts with Simple help with global macros
Creating subgroups in panel dataI am working with a panel of UK industries from 1997-2018, and wish to group some of these industrie…
Dropping group of variables if the group does not contain a certain valueDear all, I am a stata beginner so this question might sound stupid. I have a dataset that list per…
Panel data - removing individuals if criteria is not met in each yearHi. I have panel data from 2009-2016. I want to remove individuals from the data set if the variable…
Markov switching model with few time seriesHi everyone, I have times series with 11 observations on the business climate index. Can I apply Mar…
How to generate a variable that uses other variables when I have missing valuesI am trying to generate a variable (CSSD) for dispersion which is equal to the sum of the squared de…
Subscribe to:
Post Comments (Atom)
0 Response to Simple help with global macros
Post a Comment