LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2012, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 10 Jul 2012 13:16:56 -0500
Reply-To:     Bhupinder Farmaha <bhupi80singh@YAHOO.CO.IN>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Bhupinder Farmaha <bhupi80singh@YAHOO.CO.IN>
Subject:      Re: Computing new variables
Comments: To: "Keintz, H. Mark" <mkeintz@wharton.upenn.edu>,
          "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
In-Reply-To:  <E0B423A8C0D1E74B8905B2C5CB38C1AF03000873@GENO4.wharton.upenn.edu>
Content-Type: text/plain; charset="us-ascii"

Mark, the error is "ERROR: BY variables are not properly sorted on data set WORK.WHEAT".

Dan, the data looks like...

Year Plot Block Nrate Variety Sampling_stage TotDM 2011 101 1 120 Samson Node 458 2011 102 1 120 Vantage Node 589 2011 105 2 60 Faller Anthesis 598 .. .. .. 2010 101 1 120 Samson Node 789 2010 102 1 120 Vantage Node 498 2010 103 2 120 Faller Node Anthesis 895 .. .. ..

Thanks Bhupinder

-----Original Message----- From: Keintz, H. Mark [mailto:mkeintz@wharton.upenn.edu] Sent: Tuesday, July 10, 2012 12:12 PM To: Bhupinder Farmaha; SAS-L@LISTSERV.UGA.EDU Subject: RE: Computing new variables

What error message are you getting?

Regards, Mark

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Bhupinder Farmaha Sent: Tuesday, July 10, 2012 12:58 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Computing new variables

Hello all,

I am trying to compute two new variables, "Dry matter translocation" and "Dry matter translocation efficiency". The following formulas will be used for their calculations:

Dry matter translocation (DMTrans_Anth) = TotDM at sampling_stage, anthesis - TotDM at sampling_stage, mature

Dry matter translocation efficiency (DMTransEff_Anth) = (Dry matter translocation / TotDM at sampling_stage, anthesis) * 100

The independent factors in the data are Year (2011 and 2012), block (1, 2, 3, and 4), Nrate (0, 60, 120, and 180), and variety (Faller, Glenn, Vantage, and Samson). The dependent variable TotDM (Total dry matter) was measured five times each year (node, Anthesis, Anth+10, Anth+20, and Mature).

I have written the following code for this but getting error. It seems there is some problem with the logic in calculations.

Proc Sort data = wheat; by Year Block Variety Nrate Sampling_stage; run;

Data results;

format DMTrans_Anth 7.1;

format DMTransEff_Anth 7.2;

Set wheat;

By Year Block Nrate Variety Sampling_stage;

If Sampling_stage="Anthesis" then do;

TotDM_Control = TotDM;

retain TotDM_control;

end;

if sampling_stage = "Mature" then do;

DMTrans_Anth = (TotDM - TotDM_Control);

DMTransEff_Anth = (DMTrans_Anth/TotDM_Control)*100; end;

run;

Can someone please suggest me the problem in these calculations. I would love to learn if there are more than one way to do these calculations.

Thanks,

Bhupinder


Back to: Top of message | Previous page | Main SAS-L page