# SAS/ETS Web Examples

## Calculating Economic Indices

Contents | Back to Example

```
options noovp;

%let OUTLIB = sasuser.ecoidx.economic_indicators;
/*-------- create functions with proc fcmp --------*/
proc fcmp outlib= &OUTLIB;
function laspeyres_price_index( p0[*], q0[*], pn[*] ) label= "Laspeyres Price Index";
/*---------------------------------------------------------------------
* ENTRY:     laspeyres_price_index
*
* PURPOSE:   Computes Laspeyres Price index.
*
* USAGE:     idxl_p = laspeyres_price_index( p0, q0, pn );
*            p0 denotes price vector for items at time 0/base;
*            q0 denotes quantity vector for items at time 0/base;
*            pn denotes price vector for items at time n;
*            In the following example for 2 items,
*            the Laspeyres Price index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxl_p = laspeyres_price_index( p0, q0, pn );
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(q0) | dim(p0) ~= dim(pn) then do;
Put "ERROR: Arguments to laspeyres_price_index do not have the same dimensions";
return( . );
end;
num=0;den=0;
do i=1 to dim(p0);
num=num + (pn[i]*q0[i]);
den=den + (p0[i]*q0[i]);
end;
idxl_p=num/den;
return( idxl_p );
endsub;
function laspeyres_qty_index( p0[*], q0[*], qn[*] ) label= "Laspeyres Quantity Index";
/*---------------------------------------------------------------------
* ENTRY:     laspeyres_qty_index
*
* PURPOSE:   Computes Laspeyres Quantity index.
*
* USAGE:     idxl_q = laspeyres_qty_index( p0, q0, qn );
*            p0 denotes price vector for items at time 0/base;
*            q0 denotes quantity vector for items at time 0/base;
*            qn denotes quantity vector for items at time n;
*            In the following example for 2 items,
*            the Laspeyres Quantity index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxl_q = laspeyres_qty_index( p0, q0, qn );
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(q0) | dim(p0) ~= dim(qn) then do;
Put "ERROR: Arguments to laspeyres_qty_index do not have the same dimensions";
return( . );
end;
num=0;den=0;
do i=1 to dim(p0);
num=num + (qn[i]*p0[i]);
den=den + (q0[i]*p0[i]);
end;
idxl_q=num/den;
return( idxl_q );
endsub;
function paasche_price_index(p0[*], pn[*], qn[*]) label="Paasche Price Index";
/*---------------------------------------------------------------------
* ENTRY:     paasche_price_index
*
* PURPOSE:   Computes Paasche Price index.
*
* USAGE:     idxp_p = paasche_price_index( p0, pn, qn );
*            p0 denotes price vector for items at time 0/base;
*            pn denotes price vector for items at time n;
*            qn denotes quantity vector for items at time n;
*            In the following example for 2 items,
*            the Paasche Price index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxp_p = paasche_price_index( p0, pn, qn );
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(pn) | dim(p0) ~= dim(qn) then do;
Put "ERROR: Arguments to paasche_price_index do not have the same dimensions";
return( . );
end;
num=0;den=0;
do i=1 to dim(p0);
num=num + (pn[i]*qn[i]);
den =den + (p0[i]*qn[i]);
end;
idxp_p=num/den;
return( idxp_p );
endsub;

function paasche_qty_index( q0[*], pn[*], qn[*]) label="Paasche Quantity Index";
/*---------------------------------------------------------------------
* ENTRY:     paasche_qty_index
*
* PURPOSE:   Computes Paasche Quantity index.
*
* USAGE:     idxp_q = paasche_qty_index( q0, pn, qn );
*            q0 denotes quantity vector for items at time 0/base;
*            pn denotes price vector for items at time n;
*            qn denotes quantity vector for items at time n;
*            In the following example for 2 items,
*            the Paasche Quantity index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxp_q = paasche_qty_index( q0, pn, qn );
*
*
*--------------------------------------------------------------------*/
if  dim(pn) ~= dim(q0) | dim(pn) ~= dim(qn) then do;
Put "ERROR: Arguments to paasche_qty_index do not have the same dimensions";
return( . );
end;
num=0;den=0;
do i=1 to dim(q0);
num=num + (qn[i]*pn[i]);
den =den + (q0[i]*pn[i]);
end;
idxp_q=num/den;
return( idxp_q );
endsub;

function bowley_price_index(p0[*], q0[*], pn[*], qn[*]) label="Bowley Price Index";
/*---------------------------------------------------------------------
* ENTRY:     bowley_price_index
*
* PURPOSE:   Computes Bowley Price index.
*
* USAGE:     idxb_p = bowley_price_index( p0, q0, pn, qn );
*            p0 denotes price vector for items at time 0/base;
*            q0 denotes quantity vector for items at time 0/base;
*            pn denotes price vector for items at time n;
*            qn denotes quantity vector for items at time n;
*            In the following example for 2 items,
*            the Bowley Price index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxb_p = bowley_price_index( p0, q0, pn, qn );
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(q0) | dim(p0) ~= dim(pn) | dim(p0) ~= dim(qn) then do;
Put "ERROR: Arguments to bowley_price_index do not have the same dimensions";
return( . );
end;
idxb_p = .5*(laspeyres_price_index(p0, q0, pn)+ paasche_price_index(p0, pn, qn));
return( idxb_p );
endsub;

function bowley_qty_index(p0[*], q0[*], pn[*], qn[*]) label="Bowley Quantity Index";
/*---------------------------------------------------------------------
* ENTRY:     bowley_qty_index
*
* PURPOSE:   Computes Bowley Quantity index.
*
* USAGE:     idxb_q = bowley_qty_index( p0, q0, pn, qn );
*            p0 denotes price vector for items at time 0/base;
*            q0 denotes quantity vector for items at time 0/base;
*            pn denotes price vector for items at time n;
*            qn denotes quantity vector for items at time n;
*            In the following example for 2 items,
*            the Bowley Quantity index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxb_q = bowley_qty_index( p0, q0, pn, qn );
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(q0) | dim(p0) ~= dim(pn) | dim(p0) ~= dim(qn) then do;
Put "ERROR: Arguments to bowley_qty_index do not have the same dimensions";
return( . );
end;
idxb_q = .5*(laspeyres_qty_index( p0, q0, qn )+ paasche_qty_index( q0, pn, qn ));
return( idxb_q );
endsub;

function fisher_price_index(p0[*], q0[*], pn[*], qn[*]) label="Fisher Price Index";
/*---------------------------------------------------------------------
* ENTRY:     fisher_price_index
*
* PURPOSE:   Computes Fisher Price index.
*
* USAGE:     idxf_p = fisher_price_index( p0, q0, pn, qn );
*            p0 denotes price vector for items at time 0/base;
*            q0 denotes quantity vector for items at time 0/base;
*            pn denotes price vector for items at time n;
*            qn denotes quantity vector for items at time n;
*            In the following example for 2 items,
*            the Fisher Price index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxf_p = fisher_price_index( p0, q0, pn, qn);
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(q0) | dim(p0) ~= dim(pn) | dim(p0) ~= dim(qn) then do;
Put "ERROR: Arguments to fisher_price_index do not have the same dimensions";
return( . );
end;
idxf_p = sqrt((laspeyres_price_index(p0, q0, pn)* paasche_price_index(p0, pn, qn)));
return( idxf_p );
endsub;

function fisher_qty_index(p0[*], q0[*], pn[*], qn[*]) label="Fisher Quantity Index";
/*---------------------------------------------------------------------
* ENTRY:     fisher_qty_index
*
* PURPOSE:   Computes Fisher Quantity index.
*
* USAGE:     idxf_q = fisher_qty_index( p0, q0, pn, qn );
*            p0 denotes price vector for items at time 0/base;
*            q0 denotes quantity vector for items at time 0/base;
*            pn denotes price vector for items at time n;
*            qn denotes quantity vector for items at time n;
*            In the following example for 2 items,
*            the Fisher Quantity index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxf_q = fisher_qty_index( p0, q0, pn, qn);
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(q0) | dim(p0) ~= dim(pn) | dim(p0) ~= dim(qn) then do;
Put "ERROR: Arguments to fisher_qty_index do not have the same dimensions";
return( . );
end;
idxf_q = sqrt((laspeyres_qty_index(p0, q0, qn)* paasche_qty_index(q0, pn, qn)));
return( idxf_q );
endsub;

function geometricmean_price_index(p0[*], q0[*], pn[*]) label="Geometric mean Price Index";
/*---------------------------------------------------------------------
* ENTRY:     geometricmean_price_index
*
* PURPOSE:   Computes Geometric mean Price index.
*
* USAGE:     idxgm_p = geometricmean_price_index( p0, q0, pn );
*            p0 denotes price vector for items at time 0/base;
*            q0 denotes quantity vector for items at time 0/base;
*            pn denotes price vector for items at time n;
*            In the following example for 2 items,
*            the Geometric mean Price index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxgm_p = geometricmean_price_index( p0, q0, pn);
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(q0) | dim(p0) ~= dim(pn) then do;
Put "ERROR: Arguments to geometricmean_price_index do not have the same dimensions";
return( . );
end;
expp=0;
temp=1;
do i= 1 to dim(p0);
expp=expp + ( p0[i]*q0[i]);
temp=temp * ((pn[i]/p0[i])**(p0[i]*q0[i]));
end;
idxgm_p = temp**(1/expp);
return( idxgm_p );
endsub;

function geometricmean_qty_index(p0[*], q0[*], qn[*]) label="Geometric mean Quantity Index";
/*---------------------------------------------------------------------
* ENTRY:     geometricmean_qty_index
*
* PURPOSE:   Computes Geometric mean Quantity index.
*
* USAGE:     idxgm_q = geometricmean_qty_index( p0, q0, qn );
*            p0 denotes price vector for items at time 0/base;
*            q0 denotes quantity vector for items at time 0/base;
*            qn denotes quantity vector for items at time n;
*            In the following example for 2 items,
*            the Geometric mean Quantity index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxgm_q = geometricmean_qty_index( p0, q0, qn);
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(q0) | dim(p0) ~= dim(qn) then do;
Put "ERROR: Arguments to geometricmean_price_index do not have the same dimensions";
return( . );
end;
expp=0;
temp=1;
do i= 1 to dim(p0);
expp=expp + ( p0[i]*q0[i]);
temp=temp * ((qn[i]/q0[i])**(p0[i]*q0[i]));
end;
idxgm_q = temp**(1/expp);
return( idxgm_q );
endsub;

function harmonicmean_price_index(p0[*], q0[*], pn[*]) label="Harmonic mean Price Index";
/*---------------------------------------------------------------------
* ENTRY:     harmonicmean_price_index
*
* PURPOSE:   Computes Harmonic mean Price index.
*
* USAGE:     idxhm_p = harmonicmean_price_index( p0, q0, pn );
*            p0 denotes price vector for items at time 0/base;
*            q0 denotes quantity vector for items at time 0/base;
*            pn denotes price vector for items at time n;
*            In the following example for 2 items,
*            the Harmonic mean Price index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxhm_p = harmonicmean_price_index( p0, q0, pn);
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(q0) | dim(p0) ~= dim(pn) then do;
Put "ERROR: Arguments to harmonicmean_price_index do not have the same dimensions";
return( . );
end;
num=0;den=0;
do i= 1 to dim(p0);
num = num +  (p0[i]*q0[i]);
den = den +  (((p0[i]**2)*q0[i])/pn[i]);
end;
idxhm_p = num/den;
return( idxhm_p );
endsub;

function harmonicmean_qty_index(p0[*], q0[*], qn[*]) label="Harmonic mean Quantity Index";
/*---------------------------------------------------------------------
* ENTRY:     harmonicmean_qty_index
*
* PURPOSE:   Computes Harmonic mean Quantity index.
*
* USAGE:     idxhm_q = harmonicmean_qty_index( p0, q0, qn );
*            p0 denotes price vector for items at time 0/base;
*            q0 denotes quantity vector for items at time 0/base;
*            qn denotes quantity vector for items at time n;
*            In the following example for 2 items,
*            the Harmonic mean Quantity index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxhm_q = harmonicmean_qty_index( p0, q0, qn);
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(q0) | dim(p0) ~= dim(qn) then do;
Put "ERROR: Arguments to harmonicmean_qty_index do not have the same dimensions";
return( . );
end;
num=0;den=0;
do i= 1 to dim(p0);
num = num +  (p0[i]*q0[i]);
den = den +  (((q0[i]**2)*p0[i])/qn[i]);
end;
idxhm_q = num/den;
return( idxhm_q );
endsub;
function marshall_edgeworth_price_index(p0[*], q0[*], pn[*], qn[*]) label="Marshall- Edgeworth Price Index";
/*---------------------------------------------------------------------
* ENTRY:     marshall_edgeworth_price_index
*
* PURPOSE:   Computes Marshall- Edgeworth Price index.
*
* USAGE:     idxme_p = marshall_edgeworth_price_index( p0, q0, pn, qn );
*            p0 denotes price vector for items at time 0/base;
*            q0 denotes quantity vector for items at time 0/base;
*            pn denotes price vector for items at time n;
*            qn denotes quantity vector for items at time n;
*            In the following example for 2 items,
*            the Marshall- Edgeworth Price index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxme_p = marshall_edgeworth_price_index( p0, q0, pn, qn);
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(q0) | dim(p0) ~= dim(pn) | dim(p0) ~= dim(qn) then do;
Put "ERROR: Arguments to marshall_edgeworth_price_index do not have the same dimensions";
return( . );
end;
num=0;den=0;
do i= 1 to dim(p0);
num = num +  pn[i]*(q0[i]+ qn[i]);
den = den +  (p0[i]*q0[i])+(pn[i]*qn[i]);
end;
idxme_p = num/den;
return( idxme_p );
endsub;

function marshall_edgeworth_qty_index(p0[*], q0[*], pn[*], qn[*]) label="Marshall- Edgeworth Quantity Index";
/*---------------------------------------------------------------------
* ENTRY:     marshall_edgeworth_qty_index
*
* PURPOSE:   Computes Marshall- Edgeworth Quantity index.
*
* USAGE:     idxme_q = marshall_edgeworth_qty_index( p0, q0, pn, qn );
*            p0 denotes price vector for items at time 0/base;
*            q0 denotes quantity vector for items at time 0/base;
*            pn denotes price vector for items at time n;
*            qn denotes quantity vector for items at time n;
*            In the following example for 2 items,
*            the Marshall- Edgeworth Quantity index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxme_q = marshall_edgeworth_qty_index( p0, q0, pn, qn);
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(q0) | dim(p0) ~= dim(pn) | dim(p0) ~= dim(qn) then do;
Put "ERROR: Arguments to marshall_edgeworth_qty_index do not have the same dimensions";
return( . );
end;
num=0;den=0;
do i= 1 to dim(p0);
num = num +  qn[i]*(p0[i]+ pn[i]);
den = den +  (p0[i]*q0[i])+(pn[i]*qn[i]);
end;
idxme_q = num/den;
return( idxme_q );
endsub;

function walsh_price_index(p0[*], q0[*], pn[*], qn[*]) label="Walsh Price Index";
/*---------------------------------------------------------------------
* ENTRY:     walsh_price_index
*
* PURPOSE:   Computes Walsh Price index.
*
* USAGE:     idxw_p = walsh_price_index( p0, q0, pn, qn );
*            p0 denotes price vector for items at time 0/base;
*            q0 denotes quantity vector for items at time 0/base;
*            pn denotes price vector for items at time n;
*            qn denotes quantity vector for items at time n;
*            In the following example for 2 items,
*            the Walsh Price index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxw_p = walsh_price_index( p0, q0, pn, qn);
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(q0) | dim(p0) ~= dim(pn) | dim(p0) ~= dim(qn) then do;
Put "ERROR: Arguments to walsh_price_index do not have the same dimensions";
return( . );
end;
num=0;den=0;
do i= 1 to dim(p0);
num = num +  (sqrt(q0[i]*qn[i]))*pn[i];
den = den +  (sqrt(q0[i]*qn[i]))*p0[i];
end;
idxw_p = num/den;
return( idxw_p );
endsub;

function walsh_qty_index(p0[*], q0[*], pn[*], qn[*]) label="Walsh quantity Index";
/*---------------------------------------------------------------------
* ENTRY:     walsh_qty_index
*
* PURPOSE:   Computes Walsh Quantity index.
*
* USAGE:     idxw_q = walsh_qty_index( p0, q0, pn, qn );
*            p0 denotes price vector for items at time 0/base;
*            q0 denotes quantity vector for items at time 0/base;
*            pn denotes price vector for items at time n;
*            qn denotes quantity vector for items at time n;
*            In the following example for 2 items,
*            the Walsh Quantity index has been calculated.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxw_q = walsh_qty_index( p0, q0, pn, qn);
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(q0) | dim(p0) ~= dim(pn) | dim(p0) ~= dim(qn) then do;
Put "ERROR: Arguments to walsh_qty_index do not have the same dimensions";
return( . );
end;
num=0;den=0;
do i= 1 to dim(p0);
num = num +  (sqrt(p0[i]*pn[i]))*qn[i];
den = den +  (sqrt(p0[i]*pn[i]))*q0[i];
end;
idxw_q = num/den;
return( idxw_q );
endsub;

function mitchell_price_index(p0[*], wt[*], pn[*], _type_ ) label="Mitchell Price Index";
/*---------------------------------------------------------------------
* ENTRY:     mitchell_price_index
*
* PURPOSE:   Computes Mitchell Price index.
*
* USAGE:     idxm_p = mitchell_price_index( p0, wt, pn, _type_ );
*            p0 denotes price vector for items at time 0/base;
*            pn denotes price vector for items at time n;
*            wt is a measure that estimates the relative importance of the items;
*            _type_: type of weight wt provided:= qa or va=qa*p0;
*               _type_=1: User supplied wt = qa
*               _type_=2: User supplied wt = va
*            Mitchell has advocated using the average of quantities bought and
*            sold over a period of time to be used as weights.
*            In the following example for 2 items,
*            the Mitchell Price index has been calculated where wt=qa
*            has been taken to be
*            the average of q0 and qn.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxm_p = mitchell_price_index( p0, wt, pn, _type_);
*            wt = qa = avg of two quantities in test program
*
*
*--------------------------------------------------------------------*/
if  dim(p0) ~= dim(wt) | dim(p0) ~= dim(pn)  then do;
Put "ERROR: Arguments excluding _type_ to mitchell_price_index do not have the same dimensions";
return( . );
end;
num=0; den=0;
select(_type_);

when(1)
do;
do i= 1 to dim(p0);
num = num +  pn[i]*wt[i];
den = den +  p0[i]*wt[i];
end;
end;

when(2)
do;
do i= 1 to dim(p0);
num = num +  (pn[i]*wt[i]/p0[i]);
den = den +  wt[i];
end;

end;
otherwise
do;
Put "ERROR: Values for _type_ should be 1 or 2" ;
return( . );
end;
end;
idxm_p = num/den;
return( idxm_p );
endsub;

function mitchell_qty_index(q0[*], wt[*], qn[*], _type_ ) label="Mitchell Quantity Index";
/*---------------------------------------------------------------------
* ENTRY:     mitchell_qty_index
*
* PURPOSE:   Computes Mitchell Quantity index.
*
* USAGE:     idxm_q = mitchell_qty_index( q0, wt, qn, _type_ );
*            q0 denotes quantity vector for items at time 0/base;
*            qn denotes quantity vector for items at time n;
*            wt is a measure that estimates the relative importance of the items;
*            _type_: type of weight wt provided:= pa or va=pa*q0;
*               _type_=1: User supplied wt = pa
*               _type_=2: User supplied wt = va
*            Mitchell has advocated using the average of quantities bought and
*            sold over a period of time to be used as weights.
*            In the following example for 2 items,
*            the Mitchell Quantity index has been calculated where wt=pa
*            has been taken to be
*            the average of p0 and pn.
*
* NOTE:      Missing values as arguments to the function return missing value.
*
* EXAMPLES:  idxm_q = mitchell_qty_index( q0, wt, qn, _type_);
*            wt = pa = avg of two prices in test program
*
*
*--------------------------------------------------------------------*/
if  dim(q0) ~= dim(wt) | dim(q0) ~= dim(qn)  then do;
Put "ERROR: Arguments excluding _type_ to mitchell_qty_index do not have the same dimensions";
return( . );
end;
num=0; den=0;
select(_type_);

when(1)
do;
do i= 1 to dim(q0);
num = num +  qn[i]*wt[i];
den = den +  q0[i]*wt[i];
end;
end;

when(2)
do;
do i= 1 to dim(q0);
num = num +  (qn[i]*wt[i]/q0[i]);
den = den +  wt[i];
end;

end;
otherwise
do;
Put "ERROR: Values for _type_ should be 1 or 2" ;
return( . );
end;
end;
idxm_q = num/den;
return( idxm_q );
endsub;
run;

/*-------- test functions with datastep --------*/
/***calculate price index***/
options  CMPLIB= (sasuser.ecoidx);
data indices(drop=i);
array p0[2] _temporary_ (15 22);
array q0[2] _temporary_ (100 25);
array pn[2] _temporary_ (18 16);
array qn[2] _temporary_ (108 38);
array wt_q[2] _temporary_;
array wt_p[2] _temporary_;
do i =1 to dim(p0);
wt_q[i] = .5 * (q0[i]+ qn[i]);
wt_p[i] = .5 * (p0[i]+ pn[i]);
end;
idxl_p = laspeyres_price_index( p0, q0, pn );
idxp_p = paasche_price_index( p0, pn, qn );
idxb_p = bowley_price_index( p0, q0, pn, qn );
idxf_p = fisher_price_index( p0, q0, pn, qn );
idxgm_p = geometricmean_price_index( p0, q0, pn );
idxhm_p = harmonicmean_price_index( p0, q0, pn );
idxme_p = marshall_edgeworth_price_index( p0, q0, pn, qn );
idxw_p = walsh_price_index( p0, q0, pn, qn );
idxm_p = mitchell_price_index( p0, wt_q, pn, 1 ); /*<----user supplied _type_ */
idxl_q = laspeyres_qty_index( p0, q0, qn );
idxp_q = paasche_qty_index( q0, pn, qn );
idxb_q = bowley_qty_index( p0, q0, pn, qn );
idxf_q = fisher_qty_index( p0, q0, pn, qn );
idxgm_q = geometricmean_qty_index( p0, q0, qn );
idxhm_q = harmonicmean_qty_index( p0, q0, qn );
idxme_q = marshall_edgeworth_qty_index( p0, q0, pn, qn );
idxw_q = walsh_qty_index( p0, q0, pn, qn );
idxm_q = mitchell_qty_index( q0, wt_p, qn, 1 ); /*<----user supplied _type_ */
run;

data p_indices(keep=idxl_p idxp_p idxb_p idxf_p idxgm_p idxhm_p idxme_p idxw_p idxm_p);
set indices;
run;proc print data=p_indices; run;quit;

data q_indices(keep=idxl_q idxp_q idxb_q idxf_q idxgm_q idxhm_q idxme_q idxw_q idxm_q);
set indices;
run;proc print data=q_indices; run;quit;

```