Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Windows Environment Variable from the local system when running Stata via RemoteApp
From
Phil Schumm <[email protected]>
To
<[email protected]>
Subject
Re: st: Windows Environment Variable from the local system when running Stata via RemoteApp
Date
Mon, 15 Apr 2013 11:04:56 -0500
On Apr 15, 2013, at 10:33 AM, Jean-François Morazzani wrote:
> Thanks Phil for your reply, but unfortunately it does not fix my issue.
>
> The thing is that I want to use a "local/global" that will be set to some users' specific folder on their local machine. So everyone could copy the script on their machine and test/use the scripts without having to open it and modify the local path.
>
> For example my script will do the following:
>
> local ScriptsFolder "c:\Temp\Stata\"
> use "`ScriptsFolder'\data\SomeData.dta", clear
> do "`ScriptsFolder'\SomeScript.do"
> ...
>
> The thing is that I cannot pass arguments to Stata has I'm using it through RemoteApp (therefore I'm calling Stata using a .rdp shortcut on my deskptop).
>
> Thanks anyway.
> I guess I will have to find another solution, like replacing the value of the local ScriptsFolder manually or automatically via a custom script.
I may still not understand exactly what you are trying to do (or the constraints within which you are working, since I'm not familiar with RemoteApp), but in general, if you are writing code that you want to be portable (e.g., across machines, between users, etc.), you should be using relative paths instead of absolute paths. So, for example, you might place all of the code in a directory called my_project, and then structure all path references so that they are relative to the root of that directory. You can then distribute that directory any way you choose, and users simply need to fire up Stata and type
cd /path/to/my_project
do relative/path/to/do-file
If your project relies on data, you can either include copies of the data file(s) in the my_project directory, or simply have your users create one or more symlinks within my_project to the location of the data file(s).
-- Phil
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/