options notes;
* This is an example of SAS code that may be used to calculate Medians using Linear Interpolation *;
* It is provided as is. Any modifications are the responsibility of the data user. *;
* Basic concept of Linear Interpolation: *;
* 1. Place continuous data into categories *;
* 2. Find the category containing the simple median value *;
* 3. Calculate the median with linear interpolation *;
* This example is for median earnings for males who are employed full-time, year round *;
* It uses the ACS Public Use Microdata Sample (PUMS). *;
* Location of PUMS data: http://www.census.gov/programs-surveys/acs/data/pums.html *;
* Step 1: Change the libname statement to point to the location of your data *;
* Replace with the name of the dataset (e.g. pums_pus for PUMS Person data for US) *;
* Change if statement so that it is the relevant universe for your estimate *;
libname libref1 "";
data recode_data;
set libref1. (keep = st pernp agep sex wkhp wkw pwgtp adjinc) ; * <-- Replace dataset_name *;
if pernp~=. then apern = (pernp * (adjinc / 1000000)); * Using PUMS data, need to adjust person earnings for inflation *;
* Restrict data to estimate of interest: In this example median earnings of males who work full-time, year round *;
if (15