Programming the statistical procedures from SAS

Student with SAS problems

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 12
Accepted Solution

Student with SAS problems

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


Accepted Solutions
Solution
‎04-03-2014 03:52 PM
Grand Advisor
Posts: 10,050

Re: Student with SAS problems

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


All Replies
SAS Super FREQ
Posts: 3,310

Re: Student with SAS problems

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.

Occasional Contributor
Posts: 12

Re: Student with SAS problems

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?

Solution
‎04-03-2014 03:52 PM
Grand Advisor
Posts: 10,050

Re: Student with SAS problems

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 .))

Occasional Contributor
Posts: 12

Re: Student with SAS problems

Thank you a lot! It works!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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