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
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 .))
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.
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?
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 .))
Thank you a lot! It works!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.