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 (August 2000, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 30 Aug 2000 08:35:33 EDT
Reply-To:     David Wright <david_20000@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         David Wright <david_20000@HOTMAIL.COM>
Subject:      Strange Phenomonon of Running Macro
Content-Type: text/plain; format=flowed

Hi, My Dear friends,

I am so sorry I have to ask help for the followed program again. It run smoothly but I found there are very strange phenomona among them.

In this program, I want to a REWEIGHT with different RSTU (studentized residuals). When RSTU is less than 0, I want SWLSL is run since the big weight will be given to those with less value of RSTU. When RSTU is larger than zero, I want to run SWLSG since the big weight will be given those with big RSTU. Just as the followed program shown, I use a switch to realize the above function.

However, when I test the program by the critical parameters by K=5 %to 6 (when k=5, &&irs&k=-1.26 and &&ire&k=-1.25; when k=6, &&irs&k=1.31 and &&ire&k=1.32), I found the running of the program is not as what I expected. The experimental records are as followed:

Program Intercept Xcoefficient Status

RSTU<0 %then %SWLSL 114.3 18 Unexpected %ELSE %SWLSG 112.4 28 Expected

RSTU<0 %then %SWLSG 114.3 18 Unexpected %ELSE %SWLSG 110 28.48 Expected

RSTU<0 %then %SWLSG 176.1 -11 Expected %ELSE %SWLSL 160.4 -1.34 Unexpected

RSTU<0 %then %SWLSL 176.1 -11 Expected %ELSE %SWLSL 160.4 -1.34 Unexpected

From the above table, the portfolio I expected, which should be correct calculation and is shown as followed), did not come out.

RSTU<0 %then %SWLSG 176.1 -11 Expected %ELSE %SWLSL 112.4 28 Expected

It seemed that when RSTU<0, either you run SWLSG or SWLSL, the results are the same. I can't understand. To testify this hypothesis, I also performed the experiment that do not have SWITCH. The experimental records are:

K=5 %to 5 (&&irs&k=-1.26 and &&ire&k=-1.25)

Subprogram Intercept Xcoefficient Status SWLSL 114 18 Unexpected SWLSG 114 18 Unexpected

K=6 %to 6 (&&irs&k=1.31 and &&ire&k=1.32)

Subprogram Intercept Xcoefficient Status SWLSL 160 -1.34 Unexpected SWLSG 112 28.20 Expected

Obviously, in the Case of (K=5 %to 5), either performing SWLSL or SWLSG, both the results are wrong. Maybe something wrong happened either SWLSL and SWLSG. But I can't find it after trying one day. I really you give me hands. I guess it might be some obvious fact or concept I ignore.

Thanks a lot.

David

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NOTE: Copyright (c) 1989-1996 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) Proprietary Software Release 6.12 TS020 Licensed to SYRACUSE UNIVERSITY, Site 0009095001.

1 2 %macro Rdata; 3 data sample; 4 infile "p:\ctip-research\simulation_datasets\high_variance\test&i..txt"; 5 input X y; 6 run; 7 %mend Rdata; 8 9 %macro SWLSL(IN=, X=X, Y=Y, RSTU=); 10 filename myfile 'p:\ctip-research\wanted_high\swat_high_1585_error1_runresults\swat_high_1585 _error1_runresults_log.txt'; 11 proc printto log=myfile;run; 12 filename myoutput 'p:\ctip-research\wanted_high\swat_high_1585_error1_runresults\swat_high_1585 _error1_runresults_output.txt'; 13 proc printto print=myoutput;run; 14 proc reg data=sample; 15 model y=x; 16 reweight student. le &RSTU/weight=1 NOLIST; 17 reweight student. ge &RSTU/weight=0.05 NOLIST; 18 run; 19 PROC PRINTTO;run; 20 PROC PRINTTO;run; 21 %mend SWLSL; 22 23 24 %macro SWLSG(IN=, X=X, Y=Y, RSTU=); 25 filename myfile 'p:\ctip-research\wanted_high\swat_high_1585_error1_runresults\swat_high_1585 _error1_runresults_log.txt'; 26 proc printto log=myfile;run; 27 filename myoutput 'p:\ctip-research\wanted_high\swat_high_1585_error1_runresults\swat_high_1585 _error1_runresults_output.txt'; 28 proc printto print=myoutput;run; 29 proc reg data=sample; 30 model y=x; 31 reweight student. ge &RSTU/weight=1 NOLIST; 32 reweight student. le &RSTU/weight=0.05 NOLIST; 33 run; 34 PROC PRINTTO;run; 35 PROC PRINTTO;run; 36 %mend SWLSG; 37 38 %macro Mcarlo; 39 40 data s_tlp; 41 infile "p:\ctip-research\wanted_high\swat_high_1585_error1_loopnumofeachDS\swat_high _1585_error1_num_DS1-100.txt"; 42 input tlpv; 43 run; 44 45 data _null_; 46 set s_tlp; 47 call symput('tlp'||left(_n_), tlpv); 48 run; 49 50 %do i=100 %to 100; 51 52 %Rdata; 53 54 data loopsend; 55 infile "p:\ctip-research\wanted_high\swat_high_1585_error1_split\swat_high_1585_erro r1_DS&i..txt"; 56 input daset tgtNREW CrStart StrtNUM CrEnd EndNUM; 57 crstart=1000*crstart; crend=1000*crend; 58 run; 59 60 data _null_; 61 set loopsend; 62 call symput('irs'||left(_n_), crstart); 63 call symput('ire'||left(_n_), crend); 64 run; 65 66 %do k=1 %to &&tlp&i; 67 68 %do; 69 %do j=&&irs&k %to &&ire&k; 70 71 %let RSTU= %sysevalf(0.001*(&j)); 72 filename myfile ' 73 p:\ctip-research\wanted_high\swat_high_1585_error1_runresults\swat_high_1585_ error1_runresults_log.txt'; 74 proc printto log=myfile;run; 75 %put The Studentized Residual for Comparing is: &RSTU; 76 PROC PRINTTO;run; 77 78 %if rstu <0 %then 79 %do; 80 %SWLSG(IN=sample, X=X, Y=Y, RSTU=&RSTU); 81 %end; 82 %else 83 %do; 84 %SWLSL(IN=sample, X=X, Y=Y, RSTU=&RSTU); 85 %end; 86 %end; 87 %end; 88 %end; 89 90 %end; 91 92 %mend Mcarlo; 93 94 %Mcarlo;

_________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at http://profiles.msn.com.


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