data snowfall;
input month season @;
cards;
12 32.5 12 04.4 12 23.9 12 27.3 12 32.3 12 25.6 12 42.8 12 22.1
1 40.0 1 27.4 1 06.6 1 60.5 1 15.7 1 22.2 1 53.0 1 25.1
2 26.3 2 33.0 2 25.4 2 43.8 2 34.6 2 16.8 2 14.8 2 15.2
3 32.1 3 06.8 3 35.6 3 37.4 3 19.9 3 37.2 3 13.3 3 70.4
;
proc glm;
class month;
model season=month/p;
means month/hovtest=bartlett;
output out=snowfall1 predicted=ypred residual=res;
run;
I keep getting the error "ERROR: One or more variables are missing or freq or weight is zero on every observation." And I am not sure why.
I tested the below and it works for me
data snowfall;
input month season @@;
cards;
12 32.5 12 04.4 12 23.9 12 27.3 12 32.3 12 25.6 12 42.8 12 22.1
1 40.0 1 27.4 1 06.6 1 60.5 1 15.7 1 22.2 1 53.0 1 25.1
2 26.3 2 33.0 2 25.4 2 43.8 2 34.6 2 16.8 2 14.8 2 15.2
3 32.1 3 06.8 3 35.6 3 37.4 3 19.9 3 37.2 3 13.3 3 70.4
;
proc glm;
class month;
model season=month/p;
means month/hovtest=bartlett;
output out=snowfall1 predicted=ypred residual=res;
run;
quit;
Check your input data, snowfall. It does't read in correctly so you only get 4 records.
Add an extra @ so you have a double @@ on your input statement.
@abudyak wrote:
data snowfall; input month season @; cards; 12 32.5 12 04.4 12 23.9 12 27.3 12 32.3 12 25.6 12 42.8 12 22.1 1 40.0 1 27.4 1 06.6 1 60.5 1 15.7 1 22.2 1 53.0 1 25.1 2 26.3 2 33.0 2 25.4 2 43.8 2 34.6 2 16.8 2 14.8 2 15.2 3 32.1 3 06.8 3 35.6 3 37.4 3 19.9 3 37.2 3 13.3 3 70.4 ; proc glm; class month; model season=month/p;
means month/hovtest=bartlett; output out=snowfall1 predicted=ypred residual=res; run;I keep getting the error "ERROR: One or more variables are missing or freq or weight is zero on every observation." And I am not sure why.
@Reeza I still get the same error
Hi @abudyak try
data snowfall;
input month season @@;
cards;
12 32.5 12 04.4 12 23.9 12 27.3 12 32.3 12 25.6 12 42.8 12 22.1
1 40.0 1 27.4 1 06.6 1 60.5 1 15.7 1 22.2 1 53.0 1 25.1
2 26.3 2 33.0 2 25.4 2 43.8 2 34.6 2 16.8 2 14.8 2 15.2
3 32.1 3 06.8 3 35.6 3 37.4 3 19.9 3 37.2 3 13.3 3 70.4
;
proc glm;
class month;
model season=month/p;
means month/hovtest=bartlett;
output out=snowfall1 predicted=ypred residual=res;
run;
quit;
@novinosrin I still get an error
I tested the below and it works for me
data snowfall;
input month season @@;
cards;
12 32.5 12 04.4 12 23.9 12 27.3 12 32.3 12 25.6 12 42.8 12 22.1
1 40.0 1 27.4 1 06.6 1 60.5 1 15.7 1 22.2 1 53.0 1 25.1
2 26.3 2 33.0 2 25.4 2 43.8 2 34.6 2 16.8 2 14.8 2 15.2
3 32.1 3 06.8 3 35.6 3 37.4 3 19.9 3 37.2 3 13.3 3 70.4
;
proc glm;
class month;
model season=month/p;
means month/hovtest=bartlett;
output out=snowfall1 predicted=ypred residual=res;
run;
quit;
RESULT:
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.