Thanks as always to Kit Baum, a new package adostore is now available for download from SSC. In Stata, use the ssc command to do this.
The adostore package is described as below on my website, and facilitates the practice of safe ado-path management, also known as reversible ado-path management. I wrote it because, in the near future, my primary-practice data management packages are expected to co-exist in multiple versions, corresponding to different versions of the data format distributed by the Clinical Practice Research Datalink (CPRD), although they are expected all to be written in the same Stata version (Stata 13). This implies that I (and probably other Stata users in the CPRD customer base) will have to keep multiple versions of my utility programs in different ado-file folders, and choose which one to use, in any one session, using ado-path management.
My solution to this problem will involve having 2 adostore commands in my profile.do file. As in:
adostore S_ADOFACTORY, replace;
adoind;
adostore S_ADOPROFILE, replace;
The first adostore command stores the factory ado-path in the global macro S_ADOFACTORY. The adoind command is part of my SSC package adodev, and sets my ado-path as I usually like it (without any temporary extra ado-file folders). The third adostore command stores my preferred ado-path in the global macro S_ADOPROFILE. Once these 2 ado-paths have been stored, I can add temporary ado-file folders to my ado-file path, using commands like
adopath + c:/ado/cprd/cprd20170901
to access a particular version of my CPRD utility programs (dated 01 November 2017). And, if I want to restore my preferred profile ado-path, then I can type
adorestore S_ADOPROFILE
to restore my preferred base ado-path. And, if I want to use a different version of my CPRD utilities to read a different CPRD data format, then I can type
adopath + c:/ado/cprd/cprd20171201
to access the version of my CPRD utilities dated 01 December 2017 (whch I plan to write soon). And, if I want to, I can restore the factory ado-path by typing
adorestore S_ADOFACTORY
I would like to thank Alan Riley of StataCorp for his very helpful advice about ado-paths on Statalist last week.
Best wishes
Roger
----------------------------------------------------------------------------
package adostore from http://www.imperial.ac.uk/nhli/r.newson/stata10
----------------------------------------------------------------------------
TITLE
adostore: Store and restore the current ado-path
DESCRIPTION/AUTHOR(S)
adostore stores the current ado-file path to a global macro,
which defaults to S_ADOSTORE. adorestore restores a stored
ado-path to the current ado-file path from a global macro, which
defaults to S_ADOSTORE. These commands enable the user to
practice safe ado-path management by storing the current ado-path
before temporarily modifying the ado-path, and restoring the
stored ado-path after using the modified ado-path.
Author: Roger Newson
Distribution-Date: 10november2017
Stata-Version: 10
INSTALLATION FILES (click here to install)
adostore.ado
adorestore.ado
adostore.sthlp
adorestore.sthlp
----------------------------------------------------------------------------
(click here to return to the previous screen)
The adostore package is described as below on my website, and facilitates the practice of safe ado-path management, also known as reversible ado-path management. I wrote it because, in the near future, my primary-practice data management packages are expected to co-exist in multiple versions, corresponding to different versions of the data format distributed by the Clinical Practice Research Datalink (CPRD), although they are expected all to be written in the same Stata version (Stata 13). This implies that I (and probably other Stata users in the CPRD customer base) will have to keep multiple versions of my utility programs in different ado-file folders, and choose which one to use, in any one session, using ado-path management.
My solution to this problem will involve having 2 adostore commands in my profile.do file. As in:
adostore S_ADOFACTORY, replace;
adoind;
adostore S_ADOPROFILE, replace;
The first adostore command stores the factory ado-path in the global macro S_ADOFACTORY. The adoind command is part of my SSC package adodev, and sets my ado-path as I usually like it (without any temporary extra ado-file folders). The third adostore command stores my preferred ado-path in the global macro S_ADOPROFILE. Once these 2 ado-paths have been stored, I can add temporary ado-file folders to my ado-file path, using commands like
adopath + c:/ado/cprd/cprd20170901
to access a particular version of my CPRD utility programs (dated 01 November 2017). And, if I want to restore my preferred profile ado-path, then I can type
adorestore S_ADOPROFILE
to restore my preferred base ado-path. And, if I want to use a different version of my CPRD utilities to read a different CPRD data format, then I can type
adopath + c:/ado/cprd/cprd20171201
to access the version of my CPRD utilities dated 01 December 2017 (whch I plan to write soon). And, if I want to, I can restore the factory ado-path by typing
adorestore S_ADOFACTORY
I would like to thank Alan Riley of StataCorp for his very helpful advice about ado-paths on Statalist last week.
Best wishes
Roger
----------------------------------------------------------------------------
package adostore from http://www.imperial.ac.uk/nhli/r.newson/stata10
----------------------------------------------------------------------------
TITLE
adostore: Store and restore the current ado-path
DESCRIPTION/AUTHOR(S)
adostore stores the current ado-file path to a global macro,
which defaults to S_ADOSTORE. adorestore restores a stored
ado-path to the current ado-file path from a global macro, which
defaults to S_ADOSTORE. These commands enable the user to
practice safe ado-path management by storing the current ado-path
before temporarily modifying the ado-path, and restoring the
stored ado-path after using the modified ado-path.
Author: Roger Newson
Distribution-Date: 10november2017
Stata-Version: 10
INSTALLATION FILES (click here to install)
adostore.ado
adorestore.ado
adostore.sthlp
adorestore.sthlp
----------------------------------------------------------------------------
(click here to return to the previous screen)