10-12-2017 09:39 AM
I have a SAS 9.4 program that outputs an Excel workbook with 2 tabs. When I run the program it works correctly. When run by a scheduled CRON script, however, only the first tab is included.
Is there a difference in the way the SAS program runs when it is run manually vs. when it is called and run by a CRON script?
10-12-2017 09:51 AM
10-12-2017 12:21 PM
Here is the essence of my program:
libname sasprod "/sas_shared/data";
CREATE TABLE work.DataTable1 AS
where Field1 = 'P'
and (Field2 = 'ABC' or Field2 = 'DEF'))
D = date() - 1;
D_yyyymmdd = (year(D) * 10000) + (month(D) * 100) + day(D);
file_name = "/sastmp/sas_shared/output/TestFile &D_yyyymmdd..xlsx";
proc export data = work.DataTable1
create table work.Table1Summary as
(Field2, count(Field3) as Count3, Sum(Field4) as Sum4, sum(Field5) as Sum5
group by Field2);
proc export data = work.Table1Summary
10-13-2017 09:33 AM
This question has been resolved. It actually involved SAS columns that were using "field name"n references.
When I added
this resolved the problem. I still don't know why it worked without that option when running the SAS program, but failed when running it via a CRON script. But at this point, the fact that it now runs both ways is all that matters.
10-13-2017 12:39 PM
Validvarname = any is usually set for GUI environments, where badly structured data with stupid column names coming from external sources is quite common. Typically, SAS is used in a more controlled environment, so this option is not the default.
IMHO, people coming up with such column names should be sentenced to keep at least 1LD from computers.