0

I've scheduled some sas code using SAS Management Console.

However the job ends with an error: The file is empty and can not be sent.

The code which exports proc freqs to a file is as follows:

%let output_Date = %sysfunc(today(),yymmddn8.);
ods results off;
ods csv file="path/file.csv";
 %macro movem (st, en=); 
   %do j=1 %to &en.;
   %let k=%eval(&j.+1);
      proc freq data=dataname;
        tables status&j. * status&k. / nocol norow nopercent missing ;
      run;
  %end;
%mend;
%movem (st=1, en=%sysfunc(week(%sysfunc(today()), u)));
ods csv close;
ods results on;

I haven't used ods before and was wondering whether this causes the issue/error?

In Enterprise guide the code seems to give me no error.

Thanks in advance!

Sunny
  • 35
  • 1
  • 1
  • 8
  • 2
    Does `path\file.csv` get created? – Joe Sep 08 '17 at 16:31
  • 1
    It's weird to output PROC FREQ to a CSV file? Wouldn't PDF or RTF make more sense? Or Excel? – Reeza Sep 08 '17 at 16:43
  • 1
    There is nothing in your code about sending a file. When you say "the file is empty and can not be sent" is that an error message? Referring to file.csv? I suggest you post the full log from this block of code, with `options MPRINT;` . – Quentin Sep 09 '17 at 01:12

1 Answers1

1

In your code ods csv file="path/file.csv"; path is a placeholder, it should be replaced with actual path, e.g. /sas/projects/mypath,

or you can assign it to a macro variable:

%let path=/sas/projects/mypath;

Then your ods statement will look like: ods csv file="&path/file.csv";