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 (June 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 24 Jun 2009 08:01:38 -0700
Reply-To:   "dc353@hotmail.com" <dc353@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "dc353@hotmail.com" <dc353@HOTMAIL.COM>
Organization:   http://groups.google.com
Subject:   use of macros with proc nlp
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset=ISO-8859-1

I got the following back from sas technical support:

Setting up a large model in NLP is a cumbersome process. There are very few shortcuts. Using macro code can be a good way to write out similar groups of constraints and to write out an objective function. You can write macro loops on the LINCON statements to express your constraint.

Here's the code I'm trying to run:

%macro sumloop(x1:x2,port_wt); data _null_; Port_wt = 0; %do i=1 %to 2; Port_wt =port_wt + x&i; %end; run; %mend sumloop;

data quad1; input _type_ $ _name_ $ x1 x2; datalines; const . 0 0 quad x1 0.8 0 quad x2 0 .8 ;

proc nlp inquad=quad1 all; min ; parms x1 x2 = -1; bounds 0 <= x1 <= 1, 0 <= x2 <= 1; %sumloop(x1:x2,port_wt); LINCON 1 = &port_wt; run;

However, the following proc nlp call does work:

proc nlp inquad=quad1 all; min ; parms x1 x2 = -1; bounds 0 <= x1 <= 1, 0 <= x2 <= 1; LINCON 1 = x1 + x2; run;

I NEED TO PASS INTO MACRO SUMLOOP X1-X1000 AND I NEED SOMEWAY OF CREATING THE LINCON CONSTRAINT OF LINCON 1= X1+X2+X3+...+X1000. I'M TRYING TO FIGURE OUT HOW TO USE MACRO CALLS WITHIN PRO NLP SO I CAN SET PARMS,BOUNDS AND CONSTRAINTS. Will get to the objective function later. Thanks for your help


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