The EXPAND Procedure

BY Statement

  • BY variables;

A BY statement can be used with PROC EXPAND to obtain separate analyses on observations in groups defined by the BY variables. The input data set must be sorted by the BY variables and be sorted by the ID variable within each BY group.

Use a BY statement when you want to interpolate or convert time series within levels of a cross-sectional variable. For example, suppose you have a data set STATE containing annual estimates of average disposable personal income per capita (DPI) by state and you want quarterly estimates by state. These statements convert the DPI series within each state:

   proc sort data=state;
      by state date;
   run;

   proc expand data=state out=stateqtr from=year to=qtr;
      convert dpi;
      by state;
      id date;
   run;