BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bjinge
Calcite | Level 5

Hi,

We are two students, and we need SAS for our thesis. We've been working a lot with the program, but now we are stuck.

I have our end dataset, and now I want to use a model, but I always get an error, and I don't know what I am doing wrong.

I use the following code:

data TEST_01;

set WORK.QUERY_FOR_END_DATASET_SAS7BDAT; /*DIT IS DE BEGINDATASET -OAS 

DEZE NAAM AAN*/

YEAR = YEAR(DATE);

MONTH = MONTH(DATE);

run;

proc sort data=TEST_01 out=TEST_2;

by ISIN YEAR;

run;

proc reg data=TEST_2 outest=est noprint;

model RET_FUND = MARKET SMB HML ; /*SMB AND HML KAN JE WEGLATEN*/

by ISIN YEAR;

output out=b;

run;

quit;

If i do this i get the following error:

ERROR: No valid observations are found.

NOTE: The above message was for the following BY group:

      ISIN=BE0026535543(RI) YEAR=1988

2                                                          The SAS System                              20:23 Thursday, April 3, 2014

ERROR: No valid observations are found.

NOTE: The above message was for the following BY group:

      ISIN=BE0058643553(RI) YEAR=2001

ERROR: No valid observations are found.

NOTE: The above message was for the following BY group:

      ISIN=BE0126900241(RI) YEAR=1988

ERROR: No valid observations are found.

NOTE: The above message was for the following BY group:

      ISIN=BE0172903495(RI) YEAR=1999

ERROR: No valid observations are found.

NOTE: The above message was for the following BY group:

      ISIN=BE0946696730(RI) YEAR=2006

ERROR: No valid observations are found.

NOTE: The above message was for the following BY group:

      ISIN=BE0949010590(RI) YEAR=2009

ERROR: No valid observations are found.

NOTE: The above message was for the following BY group:

      ISIN=BE6212469074(RI) YEAR=2010

ERROR: No valid observations are found.

NOTE: The above message was for the following BY group:

      ISIN=BE6213172313(RI) YEAR=2010

ERROR: No valid observations are found.

NOTE: The above message was for the following BY group:

      ISIN=BE6218515391(RI) YEAR=2011

ERROR: No valid observations are found.

NOTE: The above message was for the following BY group:

      ISIN=BE6226567400(RI) YEAR=2011

NOTE: Interactivity disabled with BY processing.

NOTE: PROCEDURE REG used (Total process time):

Does anyone know that we are doing wrong?

Thanks in advance!

      real time           1.95 seconds

      cpu time            1.95 seconds

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

A quick way, depending on your actual data, may be to use a where clauseas that doesn't require changing your data.

If it is only the RET_FUND variable missing

Change

proc reg data=TEST_2

to

     proc reg data=TEST_2 (where=( RET_FUND ne .))

View solution in original post

4 REPLIES 4
Rick_SAS
SAS Super FREQ

The error messages are telling you that there are no valid observations for certain BY groups. For example, run this code:

proc print data=test_2;

where (ISIN="BE0026535543(RI)" AND YEAR=1988);

run;

You will see that the BY group has only one observation. The response variable is missing, which means that you have ZERO observations on which to conduct your regression analysis.

bjinge
Calcite | Level 5

Hi,

Thanks for the reply. Indeed we miss an observation for ISIN BE0026535543.

Is there a solution to get rid of this error?

I mean can we remove the observations with a variable missing in SAS?

ballardw
Super User

A quick way, depending on your actual data, may be to use a where clauseas that doesn't require changing your data.

If it is only the RET_FUND variable missing

Change

proc reg data=TEST_2

to

     proc reg data=TEST_2 (where=( RET_FUND ne .))

bjinge
Calcite | Level 5

Thank you a lot! It works!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 6897 views
  • 1 like
  • 3 in conversation