|
I think the Sysfunc seems to be case sensitive: you've got:
%if %sysfunc(exist(Loc.Lambdas))=1 %then %do;
but your file is loc.Lamdas. Try this (I've uppercased the libname Loc. ).
%MACRO AppendData;
%if %sysfunc(exist(work.Lambdas))=1 %then %do;
%if %sysfunc(exist(Loc.Lambdas))=1 %then %do;
data Loc.Lambdas;
set Loc.Lambdas work.Lambdas;
run;
%end;
%else %do;
data Loc.Lambdas;
set work.Lambdas;
run;
%end;
proc datasets ;
delete Lambdas;
run;
%end;
%else %put Temporary file Lambdas does not exist in the Work folder.;
%Mend;
-Mary
----- Original Message -----
From: Cristian Gugiu
To: Mary ; P. Cristian Gugiu ; SAS-L@LISTSERV.UGA.EDU
Sent: Tuesday, April 29, 2008 3:51 PM
Subject: Re: Re: SAS code works on laptop but not on workstation
Mary,
It doesn't quite fix the problem. The first two times I ran the code, it worked perfectly. Loc.Lambdas had 56 records. The third time I ran the code, the SAS session closed unexpectedly as before. When I checked the permanent dataset, there were less than 56 records. I restarted my computer and ran the code again, this time there were only 52 records. I ran it again and SAS shut down again. I reran it again, there were 54 records. Reran it again, there were 55 records. I ran it again, I had 56 records. Just in case there was an incrementing pattern, I ran it again. Now, I'm back down to 55 records. I'm not making any changes to the code, so why do I get a different number of records each time? I make sure to delete the permanent dataset before each run. When I run the same code on my laptop I get 56 records each and everytime. Anyone know what's going on?
Here is the code that I used per your suggestion.
%MACRO AppendData;
%if %sysfunc(exist(work.Lambdas))=1 %then %do;
%if %sysfunc(exist(Loc.Lambdas))=1 %then %do;
data loc.Lambdas;
set loc.Lambdas work.Lambdas;
run;
%end;
%else %do;
data loc.Lambdas;
set work.Lambdas;
run;
%end;
proc datasets ;
delete Lambdas;
run;
%end;
%else %put Temporary file Lambdas does not exist in the Work folder.;
%Mend;
----- Original Message ----
From: Mary <mlhoward@avalon.net>
To: P. Cristian Gugiu <crisgugiu@YAHOO.COM>; SAS-L@LISTSERV.UGA.EDU
Sent: Tuesday, April 29, 2008 3:54:38 PM
Subject: Re: Re: SAS code works on laptop but not on workstation
Cristian,
It doesn't sound like there's too many records there- maybe try to see if you could substitute this code for your proc append and see if it works (or at least gives you a better error message)
data loc.lamdas;
set loc.lamdas work.lamdas;
run;
-Mary
----- Original Message -----
From: P. Cristian Gugiu
To: SAS-L@LISTSERV.UGA.EDU
Sent: Tuesday, April 29, 2008 2:43 PM
Subject: Re: SAS code works on laptop but not on workstation
Thanks to one members running SAS in a Vista OS environment, I was able to
examine the log from his run. According to the log, there were 56
temporary datasets created with 1 record and 8 variables. Search
for: "NOTE: The data set WORK.LAMBDAS has 1 observations and 8 variables."
However, the final dataset located in the Loc folder is empty. Therefore,
for some reason, either the following code does not appear to work in a
Vista environment or something is preventing the temp dataset from being
appended. Anyone have any ideas what might be going on?
%MACRO AppendData;
%if %sysfunc(exist(work.Lambdas))=1 %then %do ;
/* Appends results of each run to _Data. */
Proc Append Base=Loc.Lambdas Data = Lambdas ;
run ;
proc datasets ;
delete Lambdas;
run;
%end;
%else %put Temporary file Lambdas does not exist in the Work
folder.;
%Mend;
|