Programming the statistical procedures from SAS

ERROR: No valid observations are present.

Reply
Occasional Contributor
Posts: 9

ERROR: No valid observations are present.

Hi there!

 

I found a lot in the internet concerning this error:

 

ERROR: No valid observations are present.

 

Mostly it appears when the data set is incomplete. In my case, there is all data complete. So I wonder what the problem may be...

 

Could anyone help me?

 

Best, 

 

Janna

Respected Advisor
Posts: 3,040

Re: ERROR: No valid observations are present.

Posted in reply to JKochsiek

You need to look at your data set in some viewer (like ViewTable). You can't assume that the data is all present.

 

We can't help, because we don't have your data.

--
Paige Miller
Occasional Contributor
Posts: 9

Re: ERROR: No valid observations are present.

Posted in reply to PaigeMiller

Thank you for your answer! Very appreciate that!

 

I just saw that there appear 100 rows, but I only filled 86 rows with data. That might be the problem! How can I cancel line 87 - 100?

Super User
Posts: 23,754

Re: ERROR: No valid observations are present.

Posted in reply to JKochsiek

Not likely, 86 rows is still enough for something to run.

 

First, what is your code that generates the error?

 

Second, examine all variables in the code above, using PROC FREQ or PROC MEANS to generate a missing report and examine the missing data. Replace the tableName in the code below and run it on your data set to get a report of missing/not missing. Post the results if you need further assistance.

 

%let tableName = class;

*create format for missing;

proc format ;
	value $ missfmt ' '="Missing" other="Not Missing";
	value nmissfmt .="Missing" other="Not Missing";
run;

*Proc freq to count missing/non missing;
ods table onewayfreqs=temp;

proc freq data=&tableName.;
	table _all_ / missing;
	format _numeric_ nmissfmt. _character_ $missfmt.;
run;

*Format output;

data long;
	length variable $32. variable_value $50.;
	set temp;
	Variable=scan(table, 2);
	Variable_Value=strip(trim(vvaluex(variable)));
	presentation=catt(frequency, " (", trim(put(percent/100, percent7.1)), ")");
	keep variable variable_value frequency percent cum: presentation;
	label variable='Variable' variable_value='Variable Value';
run;

proc sort data=long;
	by variable;
run;

proc transpose data=long out=want;
	by variable;
	id variable_value;
	var presentation;
run;

@JKochsiek wrote:

Thank you for your answer! Very appreciate that!

 

I just saw that there appear 100 rows, but I only filled 86 rows with data. That might be the problem! How can I cancel line 87 - 100?


 

Occasional Contributor
Posts: 9

Re: ERROR: No valid observations are present.

My code was:

 

ods output SolutionF=deftotal;
proc mixed data=CC_long convf=0.001 ;
class Measure SubjectID;
model outcome=deftotal*Measure Age*Measure MaskVol*Measure /solution;
run;

 

Could you explain me with what file I should replace tableName? 

Super User
Posts: 23,754

Re: ERROR: No valid observations are present.

Posted in reply to JKochsiek
%let tableName = CC_long;


Change the %let as shown above and run the code and check the WANT table created. 

Occasional Contributor
Posts: 9

Re: ERROR: No valid observations are present.

Thank you, now the code works.

 

When I run in I get 3 new errors:

 

ERROR: File WORK.CC_LONG.DATA doesn't exist.

ERROR: No data set open to look up variables.

ERROR: File WORK.TEMP.DATA doesn't exist.

 

This is how I created the long file:

 

data CC_long;
length Measure $26;
set CC_EigenvalueMeasures_Work;
outcome=CCI_MidEV;measure='CCI_tens1_MidEV';output;
outcome=CCI_MaxEV;measure='CCI_tens1_MaxEV';output;
outcome=CCII_MidEV;measure='CCII_tens1_MidEV';output;
outcome=CCII_MaxEV;measure='CCII_tens1_MaxEV';output;
drop CCI_MidEV
CCI_MaxEV
CCII_MidEV
CCII_MaxEV;
run;

Super User
Posts: 23,754

Re: ERROR: No valid observations are present.

Posted in reply to JKochsiek

Post your full log - that creates the data set you're trying to work on and the code I posted for the summary statistics. I suspect you need to go back to the start and verify your data was imported correctly. Did you verify that your data is correct, including number of records, variables and types (ie numeric/character are properly set).

 


@JKochsiek wrote:

Thank you, now the code works.

 

When I run in I get 3 new errors:

 

ERROR: File WORK.CC_LONG.DATA doesn't exist.

ERROR: No data set open to look up variables.

ERROR: File WORK.TEMP.DATA doesn't exist.

 

This is how I created the long file:

 

data CC_long;
length Measure $26;
set CC_EigenvalueMeasures_Work;
outcome=CCI_MidEV;measure='CCI_tens1_MidEV';output;
outcome=CCI_MaxEV;measure='CCI_tens1_MaxEV';output;
outcome=CCII_MidEV;measure='CCII_tens1_MidEV';output;
outcome=CCII_MaxEV;measure='CCII_tens1_MaxEV';output;
drop CCI_MidEV
CCI_MaxEV
CCII_MidEV
CCII_MaxEV;
run;


 

Occasional Contributor
Posts: 9

Re: ERROR: No valid observations are present.

----> My code was:

 

/* Library setup */
libname CC '/folders/myfolders';
options fmtsearch=(CC.formats);
OPTIONS nofmterr;

/* ---------------------------------------- */
/* ------- LOAD DATA FILES INTO SAS ------- */
/* ---------------------------------------- */

/* Build data tables*/

PROC IMPORT OUT= CC.CC_EigenvalueMeasures
DATAFILE= "/folders/myfolders/CC_EigenvalueMeasures.csv"
DBMS=csv REPLACE;
GETNAMES=YES;
GUESSINGROWS=MAX;
DATAROW=2;
RUN;

/* ---------------------------------------- */
/* ----------- DATA DICTIONARIES ---------- */
/* ---------------------------------------- */

/* Data Dictionaries */
ods rtf file='/folders/myfolders/CC/Dictionary1.doc';
proc contents data=CC.CC_EigenvalueMeasures varnum;
run;
ods rtf close;

/* Create work files */
data CC_EigenvalueMeasures_Work;
set CC.CC_EigenvalueMeasures;
run;

/* ---------------------------------------------- */
/* ------------- ANALYSIS ----------------------- */
/* ---------------------------------------------- */

/* ---- Analysis for all Subjects ----*/
data WorkingData_CC_all;
set CC_EigenvalueMeasures_Work;
run;

/* ---- Analysis for men only ----*/
data WorkingData_CC_men;
set CC_EigenvalueMeasures_Work;
if StartAge=. then delete;
run;

/* --------------------------------------------------------------------------- */
/* --------- START PROC MIXED ANALYSES FOR CC ---------------- */
/* --------------------------------------------------------------------------- */

/* Set up long format for CC ?? */

data CC_long;
length Measure $26;
set CC_EigenvalueMeasures_Work;
outcome=CCI_MidEV;measure='CCI_MidEV';output;
outcome=CCI_MaxEV;measure='CCI_MaxEV';output;
outcome=CCII_MidEV;measure='CCII_MidEV';output;
outcome=CCII_MaxEV;measure='CCII_MaxEV';output;
drop CCI_MidEV
CCI_MaxEV
CCII_MidEV
CCII_MaxEV;
run;

 

----> Following the Code you gave me:

 


%let tableName = CC_long;

*create format for missing;

proc format ;
value $ missfmt ' '="Missing" other="Not Missing";
value nmissfmt .="Missing" other="Not Missing";
run;

*Proc freq to count missing/non missing;
ods table onewayfreqs=temp;

proc freq data=&tableName.;
table _all_ / missing;
format _numeric_ nmissfmt. _character_ $missfmt.;
run;

*Format output;

data long;
length variable $32. variable_value $50.;
set temp;
Variable=scan(table, 2);
Variable_Value=strip(trim(vvaluex(variable)));
presentation=catt(frequency, " (", trim(put(percent/100, percent7.1)), ")");
keep variable variable_value frequency percent cum: presentation;
label variable='Variable' variable_value='Variable Value';
run;

proc sort data=long;
by variable;
run;

proc transpose data=long out=want;
by variable;
id variable_value;
var presentation;
run;

 

Yes, I had checked the data. All is there. 

Super User
Posts: 23,754

Re: ERROR: No valid observations are present.

Posted in reply to JKochsiek

LOG?

Occasional Contributor
Posts: 9

Re: ERROR: No valid observations are present.

There are no Errors until I typed in the code to set up the mixed model I send you previously. As soon as I run it, I get the following LOG:
 
ERROR: No valid observations are present.
WARNING: Output 'SolutionF' was not created. Make sure that the output object name, label, or path is spelled correctly. Also,
verify that the appropriate procedure options are used to produce the requested output object. For example, verify that
the NOPRINT option is not used.
Super User
Posts: 23,754

Re: ERROR: No valid observations are present.

Posted in reply to JKochsiek

Well for some reason SAS doesn't think your data exists and/or has no data. I can only see what you include so, if you can't paste the log and output from the code I posted, I think you'll need to wait to see if someone else can see something I missed (usually what happens) or contact SAS Tech Support.

 

Good Luck. 

Occasional Contributor
Posts: 9

Re: ERROR: No valid observations are present.

Okay.

 

Thank you a lot for your help!

Occasional Contributor
Posts: 9

Re: ERROR: No valid observations are present.

Posted in reply to JKochsiek

One more question:

 

I just run your code again and there are no errors anymore (I assume I didn't run it correct before).

 

There is some data missing, but not the one I use for my mixed model. Could this be the problem? What percentage of data per variable do you need that it runs correctly?

Super User
Posts: 23,754

Re: ERROR: No valid observations are present.

Posted in reply to JKochsiek

That depends. The issue is more likely is that some rows have missing and each row has at least one missing. 

If any of the variables in the model are missing the entire row is excluded. So if you have 86 rows, where one is is missing in each row you have no valid records. 

 


@JKochsiek wrote:

One more question:

 

I just run your code again and there are no errors anymore (I assume I didn't run it correct before).

 

There is some data missing, but not the one I use for my mixed model. Could this be the problem? What percentage of data per variable do you need that it runs correctly?


 

 

Ask a Question
Discussion stats
  • 15 replies
  • 209 views
  • 0 likes
  • 3 in conversation