|
Cristian,
Now you've got a lot of errors like this:
ERROR: (execution) Invalid argument to function.
operation : BETA at line 18759 column 52
operands : _TEM1021, _TEM1023
_TEM1021 1 row 1 col (numeric)
1.5980796
_TEM1023 1 row 1 col (numeric)
-0.37161
statement : ASSIGN at line 18758 column 225
traceback : module FUN at line 18758 column 225
module NEWTON at line 18755 column 147
module MAIN at line 18777 column 105
I would fix these before proceeding- it looks like it has stopped here. You need to test the arguments before calling the function using them.
You are getting "invalid argument to function" Beta. The Beta function requires both to be positive, so you should be able to put if statements around the call, like:
If var1 > 0 and var2 > 0 then
.... = beta( var1,var1 );
The other place you are getting an error is here:
%MACRO AppendData;
*%put Does file exist (1=Yes, 0=NO)? %sysfunc(exist(work.Lambdas));
%if %sysfunc(exist(work.Lambdas))=1 %then %do ;
/* Appends results of each run to _Data. */
Proc Append Base=Loc.Lambdas Data = Work.Lambdas ;
run ;
proc datasets ;
delete Lambdas;
run;
%end;
%else %put Temporary file Lambdas does not exist in the Work folder.;
%Mend;
You might want to consider, rather than deleting the entire dataset, to delete all the observations in the data set. Then it would always exist and you wouldn't have to put an if statement around it to check for its existence.
data Work.Lamdas;
set Work.Lamdas;
if N=. or N ^=. then delete;
run;
-Mary
----- Original Message -----
From: Cristian Gugiu
To: Mary
Sent: Tuesday, April 29, 2008 12:03 PM
Subject: Re: Re: SAS code works on laptop but not on workstation
Hi Mary,
I tried to fix the code per your example. Not sure if it totally worked. I noted in my output that the code appeared to run twice (or at least print twice in the output). Here is what I mean. The second output just repeates the first. All there are a couple of interesting errors in my log. Some of which, I know can be ignored because they are violations of statistical theory and I would not expect output. (I'm going to pour over a stats book and try to program all the validity check rules.) One that seems to be more of a warning than an error is the note about the treatment of negative numbers. SAS complains but my laptop still carries out the analysis. But some errors are definitely issues that need to be resolved. The biggest of which seems to be something about the record being locked. Not sure what part of my code is causing this. I've attached my log and most recent SAS code for you to look at. Feel free to create any directories that will work for you. The best test would be if your computer is partitioned such that temp files are written to one drive and the sas code resides on another drive. This is what the tech people as SAS told me to do to maximize SAS' efficiency.
Thanks,
Cristian
MOMENTS
MEAN VAR SKEW KURT
0 1 2 5
Estimates of Lambdas 1 to 4.
L1 L2 L3 L4
-0.067231 -0.83518 -0.242999 -0.273864
MOMENTS
MEAN VAR SKEW KURT
0 1 2 5
Estimates of Lambdas 1 to 4.
L1 L2 L3 L4
-0.067231 -0.83518 -0.242999 -0.273864
----- Original Message ----
From: Mary <mlhoward@avalon.net>
To: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>; SAS-L@LISTSERV.UGA.EDU; P. Cristian Gugiu <crisgugiu@YAHOO.COM>
Sent: Tuesday, April 29, 2008 11:11:08 AM
Subject: Re: Re: SAS code works on laptop but not on workstation
Cristian,
I tried running your code and it looks like it needs some directories set up; if you'd tell me what other setup needs to be done I could try to run it.
But in looking at it it looks like you are running IML at the bottom without being in any module. You might try putting that code in a module and having only one run statement be outside a module- I've run into this message in trying out IML; for some reason, though the documentation does not say so, it seems to want everything in a module (I'm running 9.1 on Windows XP). I've noticed that sometimes people will post IML code that has things outside a module and I get the note Dan describes about MAIN not being defined until I put the code in a module. When I've gotten that note about MAIN before IML has actually stopped and not run.
It looks like you've got this code outside the module:
DO;
Lambda={&L3, &L4}; /* starting values */
RUN Moments ;
RUN Valid ;
RUN NEWTON;
RUN NEGATIVE;
PRINT "MOMENTS" ;
PRINT MEAN VAR SKEW KURT ;
PRINT "Estimates of Lambdas 1 to 4." ;
PRINT L1 L2 L3 L4 ;
CREATE Work.Lambdas var{MEAN VAR SKEW KURT L1 L2 L3 L4};
APPEND;
CLOSE Work.Lambdas ;
END ;
For instance; here is an example where only the run is outside the module:
proc iml symsize=20000 worksize=20000;
start mod1(lookupn,set1n);
edit lookup;
read all var 'lookup_field' into lookupmatrix;
print lookupmatrix;
edit set1;
do i=1 to set1n;
read point i var 'full_names' into full_name;
foundcount=0;
do j=1 to lookupn;
if index(full_name,trim(lookupmatrix[j])) > 0 then foundcount=foundcount + 1;
print foundcount;
end;
replace;
end;
finish;
run mod1(&lookupn,&set1n);
quit;
-Mary
I also see the NOTE
NOTE: Module MAIN is undefined in IML; cannot be RUN.
As I said, I am not a macro expert and I haven't had time to work through your code, but I don't think you problem is (only) a Vista problem.
Sorry I can't be of more help,
Dan
Daniel J. Nordlund
Research and Data Analysis
Washington State Department of Social and Health Services
Olympia, WA 98504-5204
|