Search code examples
sasods

SAS ODS Documentation Syntax Error


I have many questions regarding the ODS system and am trying to educate myself. However, I am unable to do so as the SAS documentation example generates an error.

The documentation in question is Controlling Where Your Output Is Stored.

The very first example is, verbatim,

/* Specify the ODS output path */
filename odsout ".";

goptions reset=all;
ods _all_ close;
ods pdf path=odsout file="mygraph.pdf";
proc gchart data=sashelp.prdsale;
   vbar Product / sumvar=actual;
      title1 "First Quarter Sales in Canada";
      where Quarter=1 and Country="CANADA";
   run;
quit;
ods pdf close;
ods html; /* Not required in SAS Studio */

It appears that the "." in the filename statement is a place holder akin to "C:\your\file\path\here\".

I have replaced that with "C:\output". When I do this, I get the following error:

6    ods pdf path=odsout file="mygraph.pdf";
             ----
             22
             76
ERROR 22-322: Syntax error, expecting one of the following: ;, (, ANCHOR, AUTHOR, BACKGROUND, BASE,
              BODY, BOOKMARK, BOOKMARKGEN, BOOKMARKLIST, BOX_SIZING, CLOSE, COLOR, COLUMNS, COMPRESS,
              CONTENTS, CSSSTYLE, DISPLAY, DOM, DPI, EXCLUDE, FILE, FONTSCALE, GFOOTNOTE, GTITLE,
              HOST, KEYWORDS, NAMED_DEST, NEWFILE, NOBACKGROUND, NOBOOKMARKGEN, NOBOOKMARKLIST,
              NOCOLOR, NOCONTENTS, NOGFOOTNOTE, NOGTITLE, NOPDFNOTE, NOTOC, PACKAGE, PCL, PDF,
              PDFMARK, PDFNOTE, PDFTOC, PRINTER, PS, SAS, SELECT, SGE, SHOW, STARTPAGE, STYLE,
              SUBJECT, TEXT, TITLE, UNIFORM.
ERROR 76-322: Syntax error, statement will be ignored.

Am I doing something wrong or did the author of this example not compile before publishing?


Solution

  • It seem that path option is valid in ods html, but is not valid in ods pdf, but it doesn't matter because you can specify absolute path in file option.

    ods pdf file="C:\temp\mygraph.pdf";