Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- GLM Error Message

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 03-27-2018 10:26 AM
(2777 views)

Dear people

I am currently working on my master thesis with SAS and want to calculate a GLM. My goal is to check, which RK have an influence of the result in RKSchu.

I wrote this code:

DATA Allehypo Verurteilte Freigesprochen Lebend Todesstrafe Teil1 Teil2;

SET MASTER.SERIE3HYPO MASTER.SERIE3RK;

PROC GLM;

CLASS RKSchu;

MODEL RKSchu = RK1 RK3 RK4 RK5 RK6 RK7 RK8 RK9 RK11 RK12 RK13 RK17;

But I allay get the following error:

ERROR: One or more variables are missing or freq or weight is zero on every observation.

Someone around who could help me with this?

Thank you in advance and best regards from Switzerland!

12 REPLIES 12

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@fawink wrote:

ERROR: One or more variables are missing or freq or weight is zero on every observation.

Actually look at your data. Then the meaning of the error message ought to be clear. At least one of your variables is all missing.

Also, your code is poorly written, when you write this DATA statement, you create seven data sets at once, they are identical to each other, and there's no reason to do this.

```
DATA Allehypo Verurteilte Freigesprochen Lebend Todesstrafe Teil1 Teil2;
SET MASTER.SERIE3HYPO MASTER.SERIE3RK;
PROC GLM;
```

--

Paige Miller

Paige Miller

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you for your reply.

I changed the code to:

DATA WORK.ALLERK ;

SET WORK.ALLERK ;

PROC GLM;

CLASS RKSchu ;

MODEL RKSchu = RK1 RK3 RK4 RK5 RK6 RK7 RK8 RK9 RK11 RK12 RK13 RK17;

I still get the same Error Report.

Where should my variables be missing? They are in the file WORK.ALLERK.

I'm sorry if I can't explain myself very clearly, English isn't my first language...

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@fawink wrote:

Thank you for your reply.

I changed the code to:

DATA WORK.ALLERK ;

SET WORK.ALLERK ;PROC GLM;

CLASS RKSchu ;

MODEL RKSchu = RK1 RK3 RK4 RK5 RK6 RK7 RK8 RK9 RK11 RK12 RK13 RK17;

I still get the same Error Report.

Where should my variables be missing? They are in the file WORK.ALLERK.

I'm sorry if I can't explain myself very clearly, English isn't my first language...

Please post the log with the code and the errors. Paste the lines copied from the log into a code box opened using the forum's {I} menu icon to preserve error text formatting. The message boxes here will reformat text moving error diagnostic characters.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you, this is the complete log:

75 76 DATA WORK.ALLERK ; 77 SET WORK.ALLERK ; 78 NOTE: There were 2280 observations read from the data set WORK.ALLERK. NOTE: The data set WORK.ALLERK has 2280 observations and 110 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds 79 PROC GLM; 80 CLASS RKSchu ; 81 MODEL RKSchu = RK1 RK3 RK4 RK5 RK6 RK7 RK8 RK9 RK11 RK12 RK13 RK17; 82 83 84 85 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; ERROR: One or more variables are missing or freq or weight is zero on every observation. 98

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@fawink wrote:

Thank you for your reply.

I changed the code to:

DATA WORK.ALLERK ;

SET WORK.ALLERK ;PROC GLM;

CLASS RKSchu ;

MODEL RKSchu = RK1 RK3 RK4 RK5 RK6 RK7 RK8 RK9 RK11 RK12 RK13 RK17;

I still get the same Error Report.

Where should my variables be missing? They are in the file WORK.ALLERK.

I'm sorry if I can't explain myself very clearly, English isn't my first language...

You didn't do the first thing I said to do.

Actually look at your data. Look at work.allerk. What do you see? Is one of the variable all missing?

--

Paige Miller

Paige Miller

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

All the variables in the code are also in the work.allerk data file. And they all have a value. That's why I'm so clueless about what to do.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Run the following and post the output please, it will show how many missings you actually have in your data.

```
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=allerk;
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;
```

proc print data=want;

run;

Post the results from the WANT data set.

Note that your GLM statement doesn't point to a data set whichcould be problematic if you're not always running your code from the start. The same with using the same data set name in the DATA and SET statement.

```
data allwerk; *<- if there is a mistake in this step it can destroy your original data and then you'll get errors;
set allwerk;
proc glm; *NO DATA= statement????;
```

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you soooo, sooo much, I think I found the mistake. There really is a lot of data missing.

When I checked the data again, I found that every person has 10 lines, like this:

I assume thats where the error comes from, because very person should just have one line, right?

I got this data from my tutor. Any tips how I can just 'delete' the other lines?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

It depends, but cleaning the data is an import step that should never be skipped.

First run a PROC FREQ without the formats I have and PROC MEANS and examine your data thoroughly.

Depending on your data you may need to combine rows rather than just delete rows, unless for some reason all the data in those rows is missing. You can use CMISS and NMISS to count missing values.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

You're running a GLM model with a categorical outcome?

I don't think that's correct, you likely should be using a different type of analysis.

@fawink wrote:

Dear people

I am currently working on my master thesis with SAS and want to calculate a GLM. My goal is to check, which RK have an influence of the result in RKSchu.

I wrote this code:

DATA Allehypo Verurteilte Freigesprochen Lebend Todesstrafe Teil1 Teil2;

SET MASTER.SERIE3HYPO MASTER.SERIE3RK;PROC GLM;

CLASS RKSchu;

MODEL RKSchu = RK1 RK3 RK4 RK5 RK6 RK7 RK8 RK9 RK11 RK12 RK13 RK17;

But I allay get the following error:

ERROR: One or more variables are missing or freq or weight is zero on every observation.Someone around who could help me with this?Thank you in advance and best regards from Switzerland!

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you for your input, Reza. What would be my alternative?

I'm sorry for the question, but statistics is not my strength...

I'm sorry for the question, but statistics is not my strength...

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Are your RK1 RK3 RK4 RK5 RK6 RK7 RK8 RK9 RK11 RK12 RK13 RK17 variables measurements from different time periods, different locations/plots/samples or similar? Is it possible that the "missing" values were something like a zero value that was not recorded?

Or can you describe why you have so many missing values?

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 16. Read more here about **why** you should contribute and **what is in it** for you!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.