Hi,
My requirement is to create html reports under the current date folder.
In my below code, after creating the current date folder, I am facing issues when I assign ods html path=outdir. How to reference the path through the variable to create the html reports? Please help.
data _null_;
date=today();
put 'SAS date=' date yymmddn8.;
dir=Compress(put(date, yymmddn8.),' ');
put dir=;
dir1= dcreate(dir,'C:\SAS\'); /* this will create folder for the current date*/
outdir=compress('\\Gcwcnappv01021\sas_dev\TestFolder\'||dir,' ');
run;
/* Below lines to create html file*/
ods html path=outdir (url=none)
body='SASReport.html'
style=harvest;
proc report ;
title1 'SAS Report';
title2 "%sysfunc(date(),worddate18.)";
run;
ods _all_ close;
Regards
Vikram
Hello,
You are creating a data base variable (outdir) which value you expect to be available outside the data step.
The only variables that cand translate beyond the data step are macro variables.
Anyway, since you clearly state the path why don't you state it in the ods html statement ?
Hi,
As i am creating the current date folder which is not static, i cannot directly state in ods html statement. So i am deriving the path( for current date) and then specifying it in ods html statement though the variable.
Since you already create the filename in your data step, just store it into a macro variable:
data _null_;
date=today();
put 'SAS date=' date yymmddn8.;
dir=Compress(put(date, yymmddn8.),' ');
put dir=;
dir1= dcreate(dir,'C:\SAS\'); /* this will create folder for the current date*/
outdir=compress('\\Gcwcnappv01021\sas_dev\TestFolder\'||dir,' ');
call symput('outdir',trim(outdir));
run;
/* Below lines to create html file*/
ods html path="&outdir" (url=none)
body='SASReport.html'
style=harvest;
proc report ;
title1 'SAS Report';
title2 "%sysfunc(date(),worddate18.)";
run;
ods _all_ close;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.