Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[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 <>
To   <>
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'\"
> ...
> 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:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index