UCLA Academic Technology Services HomeServicesClassesContactJobs

How can I set the path variable to point to HLM?

There is a great Stata program called hlm which you can use to run HLM 6.x from within Stata and/or use it to convert your Stata data files to HLM format. (Of course this assumes that you have installed HLM 6.x on your computer.) You can get the Stata hlm  program by typing, findit hlm (see How can I used the findit command to search for programs and get additional help? for more information about using findit).

Before you can use the hlm program within Stata, you must modify your Windows path variable! This shows how you can do this.

You need to find where HLM is located on your computer. You can do this by clicking on your Start menu, then locate the HLM icon which you would use to start HLM. Instead of left clicking on the icon to start HLM, right click on the HLM icon and select Properties. This will show a window similar to the one below. 

The Target field shows the folder where HLM is stored. In this example, the folder is "C:\Program Files\HLM6\" (note that we surrounded this with quotes, and we removed whlm.exe).

Now that we know the folder where HLM is stored, we can modify the Windows path variable. We show this below for Windows XP, Windows 2000, Windows NT, and Windows 95/98. Follow the instructions for your operating system.

Windows XP

On Windows XP, 00, right click on My Computer and select Properties. Click on the Advanced tab, and then click on the Environment Variables button (see screen below).

Point to the PATH variable (see screen below) and click on Edit (see below).

At the end of the variable value box, paste in a semi-colon followed by the path where HLM is stored. In our example, HLM was stored in "C:\Program Files\HLM6\", so we pasted that to the end of the variable value (see below).

Click OK to close the third dialog box, and click OK again to close the second dialog box, and click OK again to close the first dialog box. After you restart Stata, you should be able to use the hlm command within Stata.

Windows 2000

On a Windows 2000, go to the Start menu and select menu item Settings, followed by Control Panel. In the window that opens, select System. Click on the Advanced tab, and then click on the Environment Variables button.

From the System variables box, select variable Path and click on Edit. We can add C:\StatApps\HLM504_rental12 at the end as shown below.

If variable Path does not exist, we can click on New to create the variable and edit its value in the same way shown above.

Windows NT

On Windows NT, go to the Start menu and select menu item Settings, followed by Control Panel. In the window that opens, select System. Click on the Environment tab. From the User Variables box, select  variable path. We can add C:\StatApps\HLM504_rental12 at the end of the Value field.

If the variable path does not exist, enter path in the Variable field and enter C:\StatApps\HLM504_rental12 in the Value field.
Finally we click on the Set button to update the changes and reboot the machine.

Windows 95/98

In Windows 95/98, environment variables are set in the autoexec.bat file. This file is usually located at C:\. Here is a sample autoexec.bat file.

SET COMSPEC=C:\WINDOWS\COMMAND.COM
SET windir=C:\WINDOWS
SET winbootdir=C:\WINDOWS
SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;
SET PROMPT=$p$g
SET TEMP=C:\WINDOWS\TEMP
SET TMP=C:\WINDOWS\TEMP

The PATH is a list of directories to be searched when a command is issued from the command line. The directories are separated by semicolons. We usually edit this file using a simple text editor, such as Notepad. We can modify the PATH by adding the directory to the end:

PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\StatApps\HLM504_rental12;

Or, you can append the directory to the end of the existing PATH like this: 

PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;
PATH=%PATH%;C:\StatApps\HLM504_rental12;

After modifying the file, we save it and reboot the machine. 


How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.