<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating subset of data and calculate weighted means for depth in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60841#M17255</link>
    <description>One guesses that the syntax you attempted maybe should have read:&lt;BR /&gt;
&lt;BR /&gt;
IF CROP = 'corn' THEN DELETE; /* must match the spelling and case of the value */&lt;BR /&gt;
&lt;BR /&gt;
unless you intended to check if the value of the variable CROP was the same as the variable CORN.&lt;BR /&gt;
&lt;BR /&gt;
Unless you really want to proliferate data sets, specifying a WHERE statement such as:&lt;BR /&gt;
WHERE CROP='corn'&lt;BR /&gt;
or &lt;BR /&gt;
DATA=SOILS (where=(crop='corn')) in the proc call,&lt;BR /&gt;
will accomplish the subset for any procs that do not directly support a where statement</description>
    <pubDate>Mon, 10 Jan 2011 23:05:02 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2011-01-10T23:05:02Z</dc:date>
    <item>
      <title>Creating subset of data and calculate weighted means for depth</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60838#M17252</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
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.&lt;BR /&gt;
&lt;BR /&gt;
data spring07; set soils;&lt;BR /&gt;
if crop = corn then delete;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Is there any way to model with variable ne (^=). I did try but it is not working.&lt;BR /&gt;
&lt;BR /&gt;
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&lt;BR /&gt;
&lt;BR /&gt;
Phos(weighted0-40) = (5*Phos1 + 5*Phos2 + 10*Phos3 + 20*Phos4)/40. &lt;BR /&gt;
&lt;BR /&gt;
Phos(weighted0-20) = (5*Phos1 + 5*Phos2 + 10*Phos3)/20. &lt;BR /&gt;
&lt;BR /&gt;
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).&lt;BR /&gt;
&lt;BR /&gt;
Thanks, in advance!&lt;BR /&gt;
Bhupinder</description>
      <pubDate>Mon, 10 Jan 2011 15:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60838#M17252</guid>
      <dc:creator>Bhupinder</dc:creator>
      <dc:date>2011-01-10T15:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating subset of data and calculate weighted means for depth</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60839#M17253</link>
      <description>sounds like a stats question. Have you tried the Stats forum? It is at &lt;A href="http://support.sas.com/forums/forum.jspa?forumID=46" target="_blank"&gt;http://support.sas.com/forums/forum.jspa?forumID=46&lt;/A&gt;</description>
      <pubDate>Mon, 10 Jan 2011 15:28:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60839#M17253</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-01-10T15:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: Creating subset of data and calculate weighted means for depth</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60840#M17254</link>
      <description>Hi Peter,&lt;BR /&gt;
&lt;BR /&gt;
No, I didn't post but will do now. Thanks for letting me know. Can you please suggest if there are more forums to get stat models' help especially MIXED model and repeated measures and for Analysis of Covariance. &lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Bhupinder</description>
      <pubDate>Mon, 10 Jan 2011 15:42:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60840#M17254</guid>
      <dc:creator>Bhupinder</dc:creator>
      <dc:date>2011-01-10T15:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating subset of data and calculate weighted means for depth</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60841#M17255</link>
      <description>One guesses that the syntax you attempted maybe should have read:&lt;BR /&gt;
&lt;BR /&gt;
IF CROP = 'corn' THEN DELETE; /* must match the spelling and case of the value */&lt;BR /&gt;
&lt;BR /&gt;
unless you intended to check if the value of the variable CROP was the same as the variable CORN.&lt;BR /&gt;
&lt;BR /&gt;
Unless you really want to proliferate data sets, specifying a WHERE statement such as:&lt;BR /&gt;
WHERE CROP='corn'&lt;BR /&gt;
or &lt;BR /&gt;
DATA=SOILS (where=(crop='corn')) in the proc call,&lt;BR /&gt;
will accomplish the subset for any procs that do not directly support a where statement</description>
      <pubDate>Mon, 10 Jan 2011 23:05:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60841#M17255</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2011-01-10T23:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: Creating subset of data and calculate weighted means for depth</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60842#M17256</link>
      <description>While createing subsetting of data. Is it possible to use multiple commands like IF and WHERE.&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
  set soils where=(upcase(crop) ne 'CORN'));&lt;BR /&gt;
where=(upcase(crop) ne 'SOYBEAN'));&lt;BR /&gt;
 IF sampling_stage = "F1" then delete;&lt;BR /&gt;
&lt;BR /&gt;
RUn;&lt;BR /&gt;
&lt;BR /&gt;
This code is not working. can you please suggest any improvement in it?</description>
      <pubDate>Mon, 10 Jan 2011 23:44:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60842#M17256</guid>
      <dc:creator>Bhupinder</dc:creator>
      <dc:date>2011-01-10T23:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating subset of data and calculate weighted means for depth</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60843#M17257</link>
      <description>You can specify multiple conditions using "and" or the in/not in function.  &lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
set sashelp.class;&lt;BR /&gt;
where age ne 13 and age ne 14;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
OR&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
set sashelp.class;&lt;BR /&gt;
where age not in (13, 14);&lt;BR /&gt;
run;</description>
      <pubDate>Mon, 10 Jan 2011 23:52:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60843#M17257</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2011-01-10T23:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating subset of data and calculate weighted means for depth</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60844#M17258</link>
      <description>can you see if following code is correct?&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
set soils;&lt;BR /&gt;
where crop not in ('Corn', 'Soybean') and field ne 'F1';&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 11 Jan 2011 00:08:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60844#M17258</guid>
      <dc:creator>Bhupinder</dc:creator>
      <dc:date>2011-01-11T00:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Creating subset of data and calculate weighted means for depth</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60845#M17259</link>
      <description>IF the data looks like you want it to it is. &lt;BR /&gt;
&lt;BR /&gt;
Given that you had the upcase before you probably still need it now.  &lt;BR /&gt;
&lt;BR /&gt;
When comparing strings SAS is case sensitive, ie corn ne Corn so upcasing both will correct for that. ie upcase (corn)="CORN".  &lt;BR /&gt;
&lt;BR /&gt;
HTH</description>
      <pubDate>Tue, 11 Jan 2011 00:32:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-subset-of-data-and-calculate-weighted-means-for-depth/m-p/60845#M17259</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2011-01-11T00:32:24Z</dc:date>
    </item>
  </channel>
</rss>

