Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand ›...

33
Toolkit for Weighting and Analysis of Nonequivalent Groups SAS Macros Start-Up March 9, 2014 This document provides hints for users starting out with the twang SAS macros to implement the Toolkit for Weighting and Analysis of Nonequivalent Groups (twang). twang was originally de- veloped as a package (set of functions) for the R environment for statistical computing and graphics. The SAS macros create script files to run the R functions. As a result of this feature, use of the twang macros requires users to have an operational installation of SAS and R on their computers. We assume users have installed and initialized SAS. The R environment can be downloaded for free from The Comprehensive R Archive Network (http://cran.us.r- project.org/). This start-up provides step-by-step instructions to install R on Windows 7 with a 64-bit processor. Users will need to make adaptations for other Windows operating systems. Version 3.0.2 was the current R at the time the start-up was written. Users will install the current version and will need to adapt any directory or file names to that version. There are several video tutorials on Youtube such as https://www.youtube.com/watch?v=PwfVCaMCO8U that users may want to view in addition to following the steps in this document. 1

Transcript of Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand ›...

Page 1: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

Toolkit for Weighting and Analysis of Nonequivalent Groups SAS

Macros Start-Up

March 9, 2014

This document provides hints for users starting out with the twang SAS macros to implement the

Toolkit for Weighting and Analysis of Nonequivalent Groups (twang). twang was originally de-

veloped as a package (set of functions) for the R environment for statistical computing and graphics. The

SAS macros create script files to run the R functions. As a result of this feature, use of the twang macros

requires users to have an operational installation of SAS and R on their computers. We assume users have

installed and initialized SAS.

The R environment can be downloaded for free from The Comprehensive R Archive Network (http://cran.us.r-

project.org/). This start-up provides step-by-step instructions to install R on Windows 7 with a 64-bit

processor. Users will need to make adaptations for other Windows operating systems. Version 3.0.2 was

the current R at the time the start-up was written. Users will install the current version and will need to

adapt any directory or file names to that version. There are several video tutorials on Youtube such as

https://www.youtube.com/watch?v=PwfVCaMCO8U that users may want to view in addition to following

the steps in this document.

1

Page 2: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

1. Access The Comprehensive R Archive Network (CRAN) at http://cran.us.r-project.org/

2. Select Download R for Windows

2

Page 3: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

2. Select Download R for Windows

3

Page 4: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

3. Select base

4

Page 5: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

4. Select Download R 3.0.2 for Windows

5

Page 6: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

5. Select Save on bar in Internet Explorer (see previous screen shot) or in the dialog window in Firefox (shown)

6

Page 7: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

6. Open Downloads folder

6.a Click Start Button

7

Page 8: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

6.b Select Run...

8

Page 9: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

6.c Type downloads

9

Page 10: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

6.d Select OK or hit Enter

10

Page 11: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

7. Double click R-3.0.2-win.exe to open it

11

Page 12: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

8. Select Run

12

Page 13: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

9. Click Yes to allow program to make changes if prompted (not shown)10. Select language and click OK

13

Page 14: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

11. Select choices and click Next

14

Page 15: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

11. Select choices and click Next

15

Page 16: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

11. Select choices and click Next

16

Page 17: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

11. Select choices and click Next

17

Page 18: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

11. Select choices and click Next

18

Page 19: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

11. Select choices and click Next

19

Page 20: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

11. Select choices and click Next

20

Page 21: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

12. Wait for the installation

21

Page 22: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

13. Click finish

22

Page 23: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

R is now installed. If you add R to your PATH environmental variable, you can reference R in the macro

calls with “R” rather then the entire path (e.g., “C:\Program Files\R\R-3.0.2\bin\x64\R.exe” with the

version number 3.0.2 is replaced by the version you installed). The following steps demonstrate adding R

to your PATH. This step is not required for running the twang macros.

23

Page 24: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

1. Click the start button

24

Page 25: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

3. Highlight Computer

25

Page 26: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

4. Right click Computer

26

Page 27: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

5. Click Properties

27

Page 28: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

6. Click Advanced Settings

28

Page 29: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

7. Click Environmental Variables...

29

Page 30: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

8. Highlight PATH

30

Page 31: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

9. Double click PATH

31

Page 32: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

1 10. Edit PATH by adding

“; C:\Program Files\R\R-3.0.2\bin\x64\R.exe” to the end of the current value

32

Page 33: Toolkit for Weighting and Analysis of Nonequivalent Groups SAS … › content › dam › rand › www › external › ... · 2015-08-19 · Toolkit for Weighting and Analysis of

11. Click OK on all windows until all are closed

You can now develop SAS scripts to use the twang.

33