Presentation is loading. Please wait.

Presentation is loading. Please wait.

SAS® Macros for Constraining Arrays of Numbers Charles D. Coleman Economic Statistical Methods Division US Census Bureau.

Similar presentations


Presentation on theme: "SAS® Macros for Constraining Arrays of Numbers Charles D. Coleman Economic Statistical Methods Division US Census Bureau."— Presentation transcript:

1 SAS® Macros for Constraining Arrays of Numbers Charles D. Coleman Economic Statistical Methods Division US Census Bureau

2 Why Constrain Data Make estimates consistent with external totals. Disclosure avoidance Make data sum to data of higher precision Presentation Reduce data anomalies

3 Raking: “Multiplicative” Controlling One dimension (i.e., individual variables), a.k.a. “scaling” – Nonzero data, control of same sign Ordinary rake – Multiply by ratio of control to sum. – Monotonic: All data move in same direction as control. – Preserves order: Order of data in output vector same as input vector. – Preserves ratios: Ratios of pairs of elements of output vector same as input vector. – %RAKE With BY-groups – %RAKEBY – Data of Mixed sign Generalized rake – Weighted sum of ordinary rake and difference between control, original sum. – Monotonic – Preserves order – Does not preserve ratio – Nonunique solution – %GENRAKE

4 Raking: “Multiplicative” Controlling Two dimensions (matrices) – Nonnegative data, fixed positive marginals (controls) Two-way rake, a.k.a. RAS algorithm, matrix scaling… – Alternately multiply columns, rows to controls ÷ corresponding sums – Iterate until convergence – Always converges when feasible solution exists – %RAKE2WAYS – Nonnegative data, marginals in intervals Range-RAS algorithm – %RRAS

5 Controlled Rounding Round data to preserve original sum. – Requires unconventional “wrong-way” rounding. Two Dimensions – Cox-Ernst Algorithm minimizes total cost of rounding. Sands (2003) NESUG paper covers the method. Macro based on transportation problem example in SAS documentation. – Requires SAS 9.2+. – %CONTROLROUND One Dimension – Greatest Mantissa Algorithm Simplification of Cox-Ernst Algorithm Assign output data the integral parts of input data Round up mantissas in decreasing order until sum of output data equals sum of input data %GMROUND – With BY-group processing %GMROUNDBY

6 Raking and Rounding in 1 Macro One dimension – %RAKEANDGMROUND One dimension with BY-groups – %RAKEANDGMROUNDBY Two dimensions – %RAKEANDROUND2WAYS Two dimensions with BY-groups – %RAKEANDROUND2WAYSBY

7 Files Location http://sourceforge.net/p/constrainingarrays/cod e/ci/master/tree/ – Also in paper.


Download ppt "SAS® Macros for Constraining Arrays of Numbers Charles D. Coleman Economic Statistical Methods Division US Census Bureau."

Similar presentations


Ads by Google