BookmarkSubscribeRSS Feed
JespervanBree
Calcite | Level 5

Hi all,

 

I am trying to run a proc panel data model but I am encountering a problem. Here is the code I have right now:

 

data have;
input ID date indepvar depvar;
datalines;
10001 02-02-2017 100 87
10001 02-06-2017 80 87
10001 02-08-2017 110  88
10002 02-05-2017 70 67
10002 02-08-2017 90 68
10002 02-011-2017 140 68
;
run;
proc panel data = have;
id ID date;
model indepvar = depvar / FIXTWO;
run;

 

When I run the above regression, I get the error:

There is only one cross section or time series observation. Computations will be terminated

 

There are no missing values in any of the variables and I have only selected date values with ≥2 observations.

 

I have searched this forum and there are others who have encountered this problem, but none of the solutions given solved the error. How should I arrange my data for the proc panel so that I do not face the above error?

 

Thanks in advance

1 REPLY 1
ballardw
Super User

if INDEPVAR is an independent variable and DEPVAR is dependent then you probably should reverse them on the model statement.

Generally the SAS MODEL statements are Model dependent = independents /options.

 

The example that you show only has one common date element

From the documentation:

The PANEL procedure also verifies that the time series ID values are the same for all cross sections

 

If you go to http://documentation.sas.com/api/docsets/etsug/14.2/content/etsug_code_panex02.htm?locale=en as one example note that "time period" variable values are 1 to 15 for each firm ID value.

Suggest: copy the data and code from that example and then remove ONE record for ONE firm and see the result.

 

Note that your example data does not run as you did not provide an informat for date that would work for the given code. All values would have generated errors of invalid data for date. And even with an appropriate informat

10002 02-011-2017 140 68 would be an error because either mmddyy10 or ddmmyy10 would choke on the 3 digit middle value.

 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 836 views
  • 0 likes
  • 2 in conversation