BookmarkSubscribeRSS Feed
smorkoc
Fluorite | Level 6
data csh2; 
set csh1;
if monthnum="12" or monthnum<"3"  then season= 'winter';
else if "2"<monthnum<"6" then season='spring';
else if "5"<monthnum<"9" then season='summer';
else if "8"<monthnum<"12" then season='fall';
run;

proc print data=csh2;
run;

proc sort data=csh2;
by season;
run;
ods graphics on;
proc univariate plot normal data=csh2;
by season;
var t5 t10 moisture flux1 flux2 ratio;
run;
ods graphics off;

proc glm data=csh2;
	by season;
	class t5 t10 moisture;
	model flux1=t5 t10 moisture;
	means t5 t10 moisture;
	run;

Hi ,

 

I'm trying to use proc glm procedure to detect outliers and transformations in my data. I used the code below;


I grouped months as season so that I can look at my data seasonally..

 

 

proc univariate procedure seems ok but proc glm does not.

Here is the output. I do not get that why f-value and p-value does not seem below. 

Source DF Sum of Squares Mean Square F Value Pr > F

 

Model

Error

 

8

0

 

0.09978025

0.00000000

0.01247253 . .
Corrected Total80.09978025   
Is there something wrong with my code?
Could you please help me?
 
Thanks,

Suna
9 REPLIES 9
PaigeMiller
Diamond | Level 26

Since you didn't show us the data, it's hard to give lots of details, but in whatever season you show the output for, there are only 9 data points, and 8 or more degrees of freedom in the model. You don't have enough data points to estimate all the terms in the model. So, you can't fit the model and estimate all terms; leaving 0 degrees of freedom for error, and no way to test any hypotheses. 

--
Paige Miller
Reeza
Super User
if monthnum="12" or monthnum<"3"  then season= 'winter';
else if "2"<monthnum<"6" then season='spring';
else if "5"<monthnum<"9" then season='summer';
else if "8"<monthnum<"12" then season='fall';

 

In your previous post you calculated a numeric variable, but here you're treating it as a character. SAS will do conversion or if it does character comparison it will assume 10 is < 3 because it assumes an alphabetical error. Either way that section should get fixed. 

 

You would need to include more output than shown, specifically how many observations per group. The rule of thumb is 25 observations per variable and you're showing 3 variables so that would be 75 observations per season * 4 seasons for a total of 300 observations minimum. 

 

Also include the log, it usually indicates any issues.

 


@smorkoc wrote:
data csh2; 
set csh1;
if monthnum="12" or monthnum<"3"  then season= 'winter';
else if "2"<monthnum<"6" then season='spring';
else if "5"<monthnum<"9" then season='summer';
else if "8"<monthnum<"12" then season='fall';
run;

proc print data=csh2;
run;

proc sort data=csh2;
by season;
run;
ods graphics on;
proc univariate plot normal data=csh2;
by season;
var t5 t10 moisture flux1 flux2 ratio;
run;
ods graphics off;

proc glm data=csh2;
	by season;
	class t5 t10 moisture;
	model flux1=t5 t10 moisture;
	means t5 t10 moisture;
	run;

Hi ,

 

I'm trying to use proc glm procedure to detect outliers and transformations in my data. I used the code below;


I grouped months as season so that I can look at my data seasonally..

 

 

proc univariate procedure seems ok but proc glm does not.

Here is the output. I do not get that why f-value and p-value does not seem below. 

Source DF Sum of Squares Mean Square F Value Pr > F

 

Model

Error

 

8

0

 

0.09978025

0.00000000

0.01247253  .  .
Corrected Total 8 0.09978025      
Is there something wrong with my code?
Could you please help me?
 
Thanks,

Suna

 

smorkoc
Fluorite | Level 6

I've converted month to numbers first so that I can group them as season. I did not know how to tell SAS Sep2017, Oct2017, Nov2017 should represent fall, Dec2017, Jan2018, Feb2018 should represents winter and so on. I created a new variable called season just like I mentioned it showed sep2017, which equals 9 , as fall in season variable,  Oct2017 ,which equals 10 , as fall as well and so on. 
Variable season is character right now. 

As total, I have 36 observations; 9 for fall,  9 for winter, 9 for spring , 9 for summer. Because each month has 3 observations, total number of observations for one season equals 9 observations. 

So you're saying that 36 observations are not good enough to get the right output?

PaigeMiller
Diamond | Level 26

I am saying that 9 observations in a season is not enough. You are trying to fit a model that requires more than 9 observations in a season.

--
Paige Miller
smorkoc
Fluorite | Level 6

ok, I am questioning how different planting densities affect soil respiration. I have three level of planting density.  So these 9 observations for each season belong to just one planting density. Do you suggest that I should add other planting densities and run the code?
I thought that it would be better to start with one first, but I'm trying to figure out. If you could give me any advice, I would appreciate it.

Thanks;

 

Suna 

PaigeMiller
Diamond | Level 26

@smorkoc wrote:

ok, I am questioning how different planting densities affect soil respiration. I have three level of planting density.  So these 9 observations for each season belong to just one planting density. Do you suggest that I should add other planting densities and run the code?

You don't have enough degrees of freedom to estimate all the terms in the model. You need either more data points in each season, or fewer terms in the model, or both.

 

We could be much more specific if you actually shared your data with us, in the form of SAS data step code: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

--
Paige Miller
ballardw
Super User

@smorkoc wrote:

ok, I am questioning how different planting densities affect soil respiration. I have three level of planting density.  So these 9 observations for each season belong to just one planting density. Do you suggest that I should add other planting densities and run the code?
I thought that it would be better to start with one first, but I'm trying to figure out. If you could give me any advice, I would appreciate it.

Thanks;

 

Suna 


Having done some work related to soil conditions I would be very hesitant to assume that calendar quarters are the best "grouping" available. At my location we have well known middle of March and middle of October transitions in weather that drive soil surface temperatures and precipitation and plant growth.

I do know that our soil scientist, which was modeling surface soil moisture behavior, had something that was NOT a simple regression but use using a measure of "surface shade" from vegetation as well as moisture uptake by vegetation as part of the model.

How frequent are your measurements?

smorkoc
Fluorite | Level 6

I collected the data two times in a month, but later averaged them to show monthly results. I have my data for the each month, but to answer some certain questions, I'm told that I need to seasonally look at the data. That's why I did all the conversions from month to season. 

ballardw
Super User

I might think of defining "seasonality" in terms of something else measured at the same location such as a range of mean air temperature or similar that could directly have an affect on your measured results.

 

I admit to some bias as the soil data I worked with as based on hourly measurements and multiple plots so we have lots more data points to work with and it was linked with weather data. So two measurements in a month sounds very odd in my experience.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 1067 views
  • 1 like
  • 4 in conversation