Dear All,
consider the following code demonstrating the problem:
When executed in Stata 16.1 it stops on the last command of the brown block, where there is seemingly nothing different from the previous (green) block of code, just the name of the frame is different:
Despite the previous frame create command has not resulted in any errors, the requested frame is NOT created, as evidenced by the output of the frame dir command:
I believe Stata has 2 defects, which are:
1) failure to create the requested frame;
2) failure to report that the requested frame can not or may not be created (if there is a naming convention or anything that justifies #1).
I believe the problem may be due to the specific pattern of the name which coincides with temporary names which may be generated by Stata internally, which is what I am using in my actual code:
The exact Stata version is:
Stata/MP 16.1 for Windows (64-bit x86-64)
Revision 21 Jan 2021
Compile number 873
I tend to think that Stata 16.0 didn't have this problem, or it was not showing up in my runs of equivalent code, (though I can't be 100% sure). If anyone has a way of confirming the problem in Stata 16.0/Stata16.1 this may be helpful.
The green paragraph of code is not essential for provoking the problem. It only illustrates that the problem does occur only for some names of frames (same result for __000001, 000002, etc as for the __000000).
Note also that it is important that you run the code in freshly open Stata only! (not reusing any old session, as it seems that there is something that clear all doesn't clear). The example code will run if you type tempvar tmp in the command line before running the code, even if the variable with that name doesn't exist in the current data/frame.
Note also, that Stata's manual guides us on the use of the temporary naming generators:
But doesn't mention any special way of generating temporary names for frames. The only reference I can think of was my own earlier post:
https://www.statalist.org/forums/for...eneral/1568820
and an earlier post by Dave Airey
https://www.statalist.org/forums/for...eneral/1519740
both of these examples used tempname for the same purpose and hasn't received any objection of such use from StataCorp's staff. Based on reply of Alan Riley (StataCorp) there were some changes scheduled to take place between version 16.0 and 16.1 to the relevant Stata code.
It would be helpful if I could get a clarification/guidance on the allocation of the temporary frames:
- what command should be used to generate the temporary name, any of existing 3 mentioned above or yet another one is needed for this purpose and
- whether this is safe to use in all versions of Stata or only from a certain version number, as well as
- behavior under the version control.
Thank you, Sergiy Radyakin
consider the following code demonstrating the problem:
Code:
version 16.0 clear all frame dir pwf frame create _000000 frame dir pwf frame change _000000 frame create __000000 frame dir pwf frame change __000000
When executed in Stata 16.1 it stops on the last command of the brown block, where there is seemingly nothing different from the previous (green) block of code, just the name of the frame is different:
Code:
. frame change __000000
frame __000000 not found
r(111);
Code:
. frame create __000000 . frame dir _000000 0 x 0 default 0 x 0
1) failure to create the requested frame;
2) failure to report that the requested frame can not or may not be created (if there is a naming convention or anything that justifies #1).
I believe the problem may be due to the specific pattern of the name which coincides with temporary names which may be generated by Stata internally, which is what I am using in my actual code:
Code:
tempname WSPACES frame create `WSPACES' frame change `WSPACES'
Stata/MP 16.1 for Windows (64-bit x86-64)
Revision 21 Jan 2021
Compile number 873
I tend to think that Stata 16.0 didn't have this problem, or it was not showing up in my runs of equivalent code, (though I can't be 100% sure). If anyone has a way of confirming the problem in Stata 16.0/Stata16.1 this may be helpful.
The green paragraph of code is not essential for provoking the problem. It only illustrates that the problem does occur only for some names of frames (same result for __000001, 000002, etc as for the __000000).
Note also that it is important that you run the code in freshly open Stata only! (not reusing any old session, as it seems that there is something that clear all doesn't clear). The example code will run if you type tempvar tmp in the command line before running the code, even if the variable with that name doesn't exist in the current data/frame.
Note also, that Stata's manual guides us on the use of the temporary naming generators:
tempvar assigns names to the specified local macro names that may be used as temporary variable names in a dataset. When the program or do-file concludes, any variables with these assigned names are dropped.
tempname assigns names to the specified local macro names that may be used as temporary scalar or matrix names. When the program or do-file concludes, any scalars or matrices with these assigned names are dropped.
tempfile assigns names to the specified local macro names that may be used as names for temporary files. When the program or do-file concludes, any datasets created with these assigned names are erased.
tempname assigns names to the specified local macro names that may be used as temporary scalar or matrix names. When the program or do-file concludes, any scalars or matrices with these assigned names are dropped.
tempfile assigns names to the specified local macro names that may be used as names for temporary files. When the program or do-file concludes, any datasets created with these assigned names are erased.
https://www.statalist.org/forums/for...eneral/1568820
and an earlier post by Dave Airey
https://www.statalist.org/forums/for...eneral/1519740
both of these examples used tempname for the same purpose and hasn't received any objection of such use from StataCorp's staff. Based on reply of Alan Riley (StataCorp) there were some changes scheduled to take place between version 16.0 and 16.1 to the relevant Stata code.
It would be helpful if I could get a clarification/guidance on the allocation of the temporary frames:
- what command should be used to generate the temporary name, any of existing 3 mentioned above or yet another one is needed for this purpose and
- whether this is safe to use in all versions of Stata or only from a certain version number, as well as
- behavior under the version control.
Thank you, Sergiy Radyakin
Comment