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 (September 1998, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 11 Sep 1998 09:28:35 GMT
Reply-To:     sobrinj@TOWERS.COM
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         sobrinj@TOWERS.COM
Organization: Deja News - The Leader in Internet Discussion
Subject:      Re: "Need a technical support!!How to make program automatic??"

you could define a macro

%macro sumloop; w1*r01; %do i=2 %to &choice; %if &i lt 10 %then %let j=0&i;%else %let j=&i; + w&i.*r&j %end;

%mend;

and then you have dte=(r_m-(%sumloop))**2;

cheers Jasr

In article <6t9v1l$pjj@super.tku.edu.tw>, "juan" <g6490037@tkgis.tku.edu.tw> wrote: > Hello: > Can you give me a hand ? The following is my sas program: > > ********************************************; > %let choice=20; > proc nlp data=stock outest=nlp_out1; > min terror; > parms w1-w&choice=0.05; *0.05=1/&choice; > dte=(r_m-(w1*r01+w2*r02+w3*r03+w4*r04+w5*r05+ > w6*r06+w7*r07+w8*r08+w9*r09+w10*r10+ > w11*r11+w12*r12+w13*r13+w14*r14+w15*r15+ > w16*r16+w17*r17+w18*r18+w19*r19+w20*r20))**2; > > terror+(dte); > bounds 0<=w1-w&choice<=1; > lincon > 1=w1+w2+w3+w4+w5+w6+w7+w8+w9+w10+w11+w12+w13+w14+w15+w16+w17+w18+w19+w20; > **********************************************; > > Now if > %let choice=25; > then > parms w1-w&choice=1/&choice=1/25=0.04; > dte=(r_m-(w1*r01+w2*r02+w3*r03+w4*r04+w5*r05+ > w6*r06+w7*r07+w8*r08+w9*r09+w10*r10+ > w11*r11+w12*r12+w13*r13+w14*r14+w15*r15+ > > w16*r16+w17*r17+w18*r18+w19*r19+w20*r20+w21*r21+w22*r22+w23*r23+w24*r24+w25* > r25))**2; > lincon > > 1=w1+w2+w3+w4+w5+w6+w7+w8+w9+w10+w11+w12+w13+w14+w15+w16+w17+w18+w19+w20+w21 > +w22+w23+w24+w25 > > Because I can change the number of choice,(p.s :In order to > automatize the program,so I > let the number of choice that is variable), so I want to define : > > parms w1-w&choice=1/&choice; > dte=(r_m-sum(of w1*r01-w&choice*r&choice))**2; > lincon 1=sum(of w1-w&choice); > > but when I write them (parms w1-w&choice=1/&choice; dte=(r_m-sum(of > w1*r01-w&choice*r&choice))**2; > lincon 1=sum(of w1-w&choice);) > into the sas program, I can't execute the program.It is wrong! Can > you tell me "Why"? > > Can you tell me how to correct the program? I really need your > help !! > >

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum


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