The ODS HTML statement generates errors in the SAS® 9.4 TS1M5 windowing environment when the FILE= option includes a fully qualified path


Error messages like the following might be generated when you use an ODS HTML statement with a FILE= option that specifies a fully qualified path with a directory and a filename:

ERROR: A component of C:\Users\userid\AppData\Local\Temp\SAS Temporary Files\_TD11200_D79945_\c:\test\test.html is not a directory.
ERROR: No body file. HTML output will not be created.

This is most likely to occur beginning in the fifth maintenance release of SAS® 9.4 (TS1M5) when you use the SAS® windowing environment.

The problem occurs because the "Use SASWORK" option is set as the default in the SAS registry and preferences. This causes the WORK folder to be prefixed to the path that is specified with the FILE= option.

There are three possible circumventions for this issue. Choose one of the following:

1. Use the best practice for generating HTML files. Separate the path from the filename using a combination of the PATH= option to specify the directory, and the FILE= option to specify the filename. For example:

ods html path="c:\temp" file="myfile.html";

proc print data=sashelp.class;
run;

ods html close;

2. Select ToolsOptions ► Preferences from the SAS menu bar and select the Results tab. Clear the Use SASWORK check box.

3. Modify your SAS registry to disable the "Use SASWORK" option. This can be done interactively using the SAS Registry editor or by using PROC REGISTRY to modify this setting programmatically.

The sample code below saves the registry key settings to a temporary file with the DATA step, and then uses PROC REGISTRY to import the key settings. The "Use SASWORK" option will not be enabled for subsequent ODS HTML statements.

filename source temp;
data _null_;
    file source;
    put '[ODS\DMS\DESTINATIONS\MARKUP\HTML4]';
    put ' "Use SASWORK" = "Off" ';
run;
/*---------------------------*/
/* Change the SAS registry */
/*---------------------------*/
proc registry import=source;
run;
/*-------------------------------------------------*/
/* Notify an existing destination that */
/* it needs to reprocess the preferences. */
/*-------------------------------------------------*/
ods preferences;