0

I'm trying to limit the number of observations included in ODS output table. My attempt is pretty basic:

OPTIONS NODATE number pageno=1 rightmargin=0.25in leftmargin=0.25in topmargin=0.4in bottommargin=0.4in;
options sysprintfont=("SAS Monospace" normal regular 8 ALL) orientation=landscape;
ODS LISTING CLOSE;
ODS NORESULTS;
ods TAGSETS.EXCELXP PATH="C:\TEMP" FILE= "&Place._RequiredFlaggedRecords.XML" STYLE=NORMALPRINTER;
/*Sets number of observations allowed per ODS*/
%let obs=100;

ODS TAGSETS.EXCELXP OPTIONS (EMBEDDED_TITLES='YES' EMBEDDED_FOOTNOTES='YES' SHEET_NAME='Outdated');
proc print data=&Place (obs=&obs) (rename = (CREATE_DATE = DATE_PROCESSED EARLIEST_DATE_TIME=VISIT_DATE_TIME EARLIEST_DATE=VISIT_DATE)) noobs;
        var
            DATEDIFF
            DATE_PROCESSED
            VISIT_DATE
            VISIT_DATE_TIME
                            ;
                WHERE DATEDIFF >=60 ;
        title1 j=l "Outdated Records " ;
        title2 j=l 'This page reflects the records which were received more than 60 days following';
RUN;

Log file returns:

NOTE: Line generated by the macro variable "OBS".
1      100
       ---
       22
       76

ERROR 22-322: Expecting a quoted string.

ERROR 76-322: Syntax error, statement will be ignored.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.09 seconds
      cpu time            0.01 seconds

Attempted using %eval to make 100 numeric instead of character. Also replaced &obs with 100 instead of using macro. Both had same results as above.

Any help would be appreciated!

Joe
  • 62,789
  • 6
  • 49
  • 67
S Cross
  • 17
  • 5
  • As stated above, I have tried other methods to no avail. All of my research says that all 3 methods should work, yet none do. – S Cross Aug 14 '15 at 20:19

1 Answers1

2

Most likely your problem is that you have a second set of parens. This works fine:

ods html file="c:\temp\blah.html" path="";
proc print data=sashelp.class(obs=10 rename=name=namer);
run;
ods html close;

Your error is consistent with not putting obs=10 inside the parens from rename. A different error would occur if you have it like above (two sets of parens). Put all dataset options in one set of parens.

Just to be clear, this is not an ODS related option. This is a data set option, nothing more. And macro variables don't have "types" so %eval is irrelevant here.

Joe
  • 62,789
  • 6
  • 49
  • 67
  • Thank you for your assistance! Am trying combining parens now. However, per SAS support and help files, macro variables always contain character data. http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a002293823.htm – S Cross Aug 14 '15 at 20:37
  • Macro variables always contain *text*. They have no concept of type - there is no 'numeric' or 'character' concept. Hence your `%eval` isn't doing anything: `%eval` still returns *text*. `%eval` tells SAS to evaluate text as a numeric for the purpose of doing some math on it - then returns back result as text. – Joe Aug 14 '15 at 20:43
  • Sorry, new here and hit enter too soon on previous! – S Cross Aug 14 '15 at 20:43
  • Well, it would be nice if the help files mentioned that instead! Would have saved me some time! – S Cross Aug 14 '15 at 20:45
  • This fixed the problem! Thank you, Joe! – S Cross Aug 14 '15 at 20:58