In SAS Energy Forecasting, when you delete a diagnose instance, the associated forecast-instance folders are not deleted.
Follow these steps to delete the extra folders for the orphaned forecast-instances:
Windows: C:\Program Files\SASHome\SASFoundation\9.4\enfcsvr\sasmacro
UNIX: SAS94_parent_folder/SAS94/SASHome/SASFoundation/9.4/sasautos
From a command prompt for Windows, issue these commands:
From a command prompt for UNIX, issue these commands:
Click the Hot Fix tab in this note to access the hot fix for this issue.
Product Family | Product | System | Product Release | SAS Release | ||
Reported | Fixed* | Reported | Fixed* | |||
SAS System | SAS Energy Forecasting | Microsoft® Windows® for x64 | 3.1 | |||
Linux for x64 | 3.1 |
%macro fcst_cleanup;
%if %symexist(sef_delim) = 0 %then
%do;
%if &sysscp eq WIN %then
%do;
%let sef_delim = %str(\);
%end;
%else
%do;
%let sef_delim = %str(/);
%end;
%end;
%macro find_fcst_instances(root=);
data instance_dirs (compress=no);
keep time_series_path_nm;
length fref $8 time_series_path_nm filename $120;
rc = filename(fref, "&root");
if rc = 0 then
do;
did = dopen(fref);
rc = filename(fref);
end;
else
do;
length msg $200;
msg = sysmsg();
putlog msg=;
did = .;
end;
if did <= 0 then do;
putlog 'ERROR: Unable to open ' Path=;
return;
end;
dnum = dnum(did); /* Determine # of files/directories in folder. */
do i = 1 to dnum; /* Cycle through all of files/directories. */
filename = dread(did, i);
fid = mopen(did, filename);
/* A return value of 0 from mopen means a directory name. */
if fid = 0 then
do;
/* A directory name was found; calculate the complete */
/* path, and add it to the instance_dirs data set. */
time_series_path_nm = catt("&root", "&sef_delim", filename);
output;
end;
end;
rc = dclose(did);
run;
%mend find_fcst_instances;
%let libref = sasef;
/***************************************************************************************************/
/* Create table containing all forecast definition paths. */
/***************************************************************************************************/
proc sql noprint;
create table forecast_defs as select time_series_path_nm
from &libref..time_series
where definition_flg = "TRUE";
quit;
proc sql noprint;
select count(*) into :rec_cnt
from forecast_defs;
quit;
data all_instance_dirs;
length time_series_path_nm $120;
stop;
run;
%if &rec_cnt > 0 %then %do;
/***************************************************************************************************/
/* Cycle through forecast_defs table adding records to all_instance_dirs table */
/***************************************************************************************************/
%do i = 1 %to &rec_cnt;
data _null_;
set forecast_defs(firstobs=&i obs=&i);
call symput("fcst_def_path_nm", time_series_path_nm);
run;
%find_fcst_instances(root=&fcst_def_path_nm);
proc append base=all_instance_dirs data=instance_dirs;
%end;
%end;
/***************************************************************************************************/
/* Create table containing all orphaned forecast instance folders. */
/***************************************************************************************************/
proc sql noprint;
create table orphaned_fcst_instance_path as select time_series_path_nm
from all_instance_dirs
where time_series_path_nm not in (select time_series_path_nm from &libref..time_series);
quit;
%let rec_cnt = 0 ;
proc sql noprint;
select count(*) into :rec_cnt
from orphaned_fcst_instance_path;
quit;
%if &rec_cnt > 0 %then %do;
/***************************************************************************************************/
/* Cycle through orphaned_fcst_instance_path table deleting paths of the ophaned forecast */
/* instances. */
/***************************************************************************************************/
%do i = 1 %to &rec_cnt;
data _null_;
set orphaned_fcst_instance_path(firstobs=&i obs=&i);
call symput("instance_path", time_series_path_nm);
run;
%sef_delete_dir(path=&instance_path);
%end;
%end;
%mend fcst_cleanup;
A fix for this issue for SAS Energy Forecasting Mid-Tier 3.2 is available at:
https://tshf.sas.com/techsup/download/hotfix/HF2/Z54.html#58532Type: | Problem Note |
Priority: | medium |
Date Modified: | 2017-01-26 13:00:12 |
Date Created: | 2016-06-29 15:13:00 |