turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Creating subset of data and calculate weighted mea...

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-10-2011 10:43 AM

Hi,

I want to create subset of data based on one level of independent variable. I have used the following code to create subset of the data but it didn't work.

data spring07; set soils;

if crop = corn then delete;

run;

Is there any way to model with variable ne (^=). I did try but it is not working.

My second question is to calculate weighted means based on depths from that particular subset of data. I want to get weighted means of Phos variable based on depth as per following formula

Phos(weighted0-40) = (5*Phos1 + 5*Phos2 + 10*Phos3 + 20*Phos4)/40.

Phos(weighted0-20) = (5*Phos1 + 5*Phos2 + 10*Phos3)/20.

I don't know how I can do that because data has different other variables like Tillplc, Prate, Krate, and sampling location (in-row and between row).

Thanks, in advance!

Bhupinder

I want to create subset of data based on one level of independent variable. I have used the following code to create subset of the data but it didn't work.

data spring07; set soils;

if crop = corn then delete;

run;

Is there any way to model with variable ne (^=). I did try but it is not working.

My second question is to calculate weighted means based on depths from that particular subset of data. I want to get weighted means of Phos variable based on depth as per following formula

Phos(weighted0-40) = (5*Phos1 + 5*Phos2 + 10*Phos3 + 20*Phos4)/40.

Phos(weighted0-20) = (5*Phos1 + 5*Phos2 + 10*Phos3)/20.

I don't know how I can do that because data has different other variables like Tillplc, Prate, Krate, and sampling location (in-row and between row).

Thanks, in advance!

Bhupinder

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-10-2011 12:33 PM

At the start of experiment and at the end of each year (2007, 2008, and 2009) we measured soil parameters (phosphorus, potassium, calcium, and magnesium) to quantify the effect of treatments at different depths and different parts of the plots, aka, “loc” (IR-at the planting row; BR- between two planting rows). My second question in the original post came from the idea to quantify how much soil phosphorus increased or decreased for top 18 cm (weighted means of 0-5, 5-10, and 10-18) at the end of each year from initial values as well as from the first year. This can be calculate for locations separately and also for overall each plot.

Soybean experiment (2007 – 09) was planned as RCBD with split split plot arrangements of treatments with three replications. Three tillage treatments (NTBC, NTDP, and STDP) were done in three blocks as main treatments which I am calling as whole plots. Each block (whole plot) was divided into four parts to apply four phosphorus levels (0, 12, 24, and 36 kg/ha) which I am calling as sub-plots. These sub-plots were further divided into four parts to apply four potassium levels (0, 42, 84, and 168 kg/ha) which I am calling as sub-sub-plots or “PLOTS”. For year 2008 and 2009, we sampled all the plots but in the third year, we sampled plots only receiving 5 particular fertility treatments out of 16 combinations of P and K. Therefore, I have fertility (P-K) as category.

We sampled soil at two particular “locations” (within two planting rows and at the planting rows) and four depths (0-5, 5-10, 10-20, and 20-40) within PLOTS.

To handle this analysis, I need to subset this data for each MIXED model. I just want to keep only one data file to avoid confusion.

Thanks

Bhupinder

Soybean experiment (2007 – 09) was planned as RCBD with split split plot arrangements of treatments with three replications. Three tillage treatments (NTBC, NTDP, and STDP) were done in three blocks as main treatments which I am calling as whole plots. Each block (whole plot) was divided into four parts to apply four phosphorus levels (0, 12, 24, and 36 kg/ha) which I am calling as sub-plots. These sub-plots were further divided into four parts to apply four potassium levels (0, 42, 84, and 168 kg/ha) which I am calling as sub-sub-plots or “PLOTS”. For year 2008 and 2009, we sampled all the plots but in the third year, we sampled plots only receiving 5 particular fertility treatments out of 16 combinations of P and K. Therefore, I have fertility (P-K) as category.

We sampled soil at two particular “locations” (within two planting rows and at the planting rows) and four depths (0-5, 5-10, 10-20, and 20-40) within PLOTS.

To handle this analysis, I need to subset this data for each MIXED model. I just want to keep only one data file to avoid confusion.

Thanks

Bhupinder

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-11-2011 12:37 AM

>Is there any way to model with variable ne (^=). I did try but it is not working.

Yes. proc mixed data=spring07(where crop ne 'corn' ) ......

>Phos(weighted0-40) = (5*Phos1 + 5*Phos2 + 10*Phos3 + 20*Phos4)/40.

You can just make hard code to get it.

data sprint0;

Phos_weighted= (5*Phos1 + 5*Phos2 + 10*Phos3 + 20*Phos4)/40.

BTW, the best way to get your answer is to give your origin data and what your output looks like.

Ksharp

Yes. proc mixed data=spring07(where crop ne 'corn' ) ......

>Phos(weighted0-40) = (5*Phos1 + 5*Phos2 + 10*Phos3 + 20*Phos4)/40.

You can just make hard code to get it.

data sprint0;

Phos_weighted= (5*Phos1 + 5*Phos2 + 10*Phos3 + 20*Phos4)/40.

BTW, the best way to get your answer is to give your origin data and what your output looks like.

Ksharp

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-16-2011 03:06 PM

Notice that KSharp placed quotes around the literal 'corn'. This comparison is case sensitive.

Also observe the way that the variable is named in the equation. Naming conventions must be followed.

Also observe the way that the variable is named in the equation. Naming conventions must be followed.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-16-2011 09:38 PM

Dear Arther Carpenter:

I do not know to say what.

Ksharp Message was edited by: Ksharp

I do not know to say what.

Ksharp Message was edited by: Ksharp