LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (September 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 10 Sep 2004 10:05:08 -0500
Reply-To:     "Dunn, Toby" <Toby.Dunn@TEA.STATE.TX.US>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Dunn, Toby" <Toby.Dunn@TEA.STATE.TX.US>
Subject:      Re: Help with netpv function require a macro
Comments: To: Chuck <sasnewb@ZWALLET.COM>
Content-Type: text/plain; charset="us-ascii"

Chuck,

Consider (untested macro code;

%macro NPV; %local x I;

%do I = 1 to 37; npv&I = netpv(0.05,1,-1000, %do x = &I to 37; %if &x ne 37 %then %do; mth&I, %end; %else %if &x = 37 %then %do; mth&x); %end; %end; %mend NPV;

data whatever; set yourdataset;

%NPV;

run;

Should do it;

HTH Toby Dunn -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Chuck Sent: Friday, September 10, 2004 9:47 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Help with netpv function require a macro

I have a series of values stored in variables mth1, mth2, mth3 up to mth37. I wish to calculate a series of NPV figures for each month ie,

npv1 = netpv(0.05,1,-1000, mth1, mth2, mth3, ........., mth37); npv2 = netpv(0,05,1,-1000, mth2, mth3, ........, mth37);

and so on up to

npv37 = netpv(0,05,1,-1000,mth37);

Can anyone offer a simple solution to do this?

Thanks,

A SAS newbie banging his head against the wall!


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