Search code examples
sas

"Expecting a Name" (SAS) Proc Panel


I am receiving a very frustrating SAS error when trying to use PROC PANEL.

Expecting a name

I have created some sample code that reproduces the error. Any ideas on what I'm missing?

876        PROC SORT DATA=TEMP OUT=TEMPSORTED;
877         BY OBS_DATE;
878        RUN;

NOTE: There were 26 observations read from the data set WORK.TEMP.
NOTE: The data set WORK.TEMPSORTED has 26 observations and 2 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds
      

879        
880        PROC PANEL DATA=TEMPSORTED;
881         ID OBS_DATE;
                       _
                       22
****ERROR 22-322: Expecting a name.****  
882         LAG DEGREES_F(1) / OUT=TEMP_W_LAG;
ERROR: Variable NAME not found.
883        RUN;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PANEL used (Total process time):
      real time           0.06 seconds
      cpu time            0.00 seconds

Here is an entire section of code which reproduces the error:

DATA TEMP;
    INPUT OBS_DATE mmddyy10. DEGREES_F @17;
    FORMAT OBS_DATE mmddyy10.;
    datalines;
11/01/2014  44
11/02/2014  53
11/03/2014  64
11/04/2014  61
11/05/2014  63
11/06/2014  52
11/07/2014  45
11/08/2014  49
11/09/2014  53
11/10/2014  65
11/11/2014  61
11/12/2014  33
11/13/2014  31
11/14/2014  29
11/15/2014  33
11/16/2014  33
11/17/2014  25
11/18/2014  21
11/19/2014  33
11/20/2014  30
11/21/2014  36
11/22/2014  54
11/23/2014  54
11/24/2014  51
11/25/2014  30
11/26/2014  32
;

PROC SORT DATA=TEMP OUT=TEMPSORTED; 
    BY OBS_DATE; 
RUN;

PROC PANEL DATA=TEMPSORTED;
    ID OBS_DATE;
    LAG DEGREES_F(1) / OUT=TEMP_W_LAG;
RUN;

Solution

  • Proc Panel is for when data is both time series and cross sectional. Your data doesn't appear to be cross sectional, but time series alone.

    Additionally ID requires a Cross Section ID and Time Variable. You could try to simply add a cross section ID and see if that gives you what you want, but you may want to explore other more appropriate procedures.