Desktop productivity for business analysts and programmers

Move N= to top of report

Reply
N/A
Posts: 0

Move N= to top of report

Is it possible to move the record count that comes out at the bottom of a report to the Title? or top of report?
SAS Super FREQ
Posts: 8,814

Re: Move N= to top of report

Hi:
If you are talking about the List Data task, then the N count automatically comes at the bottom of the report and you cannot change that.

If you wanted to switch to writing code and turn to using PROC REPORT, then you could get the count BEFORE the detail lines using PROC REPORT. Tech Support could help you figure the syntax out if this is the alternative you decide on.

Otherwise, using SAS macro variables and the special macro function %SYSFUNC, you can get the number of observations into a TITLE like this:
[pre]

%let dsid=%sysfunc(open(sashelp.class));
%let num=%sysfunc(attrn(&dsid,nobs));
%let rc=%sysfunc(close(&dsid));

proc print data = sashelp.class;
title "N is: &num for sashelp.class";
run;

[/pre]
Here's how it works:
1) get the "ID" of the file you're interested in using the OPEN function
2) USE the "ID" with the ATTRN function. The attribute you're interested in is the NOBS or number of Obs. The macro variable &NUM will now hold the number of obs in the data set.
3) close the file you just opened (good housekeeping)

You just have to make sure that the name you use in the %LET statements is the same name that EG will be using. Here, I hardcoded it so you could submit the code from a code node in EG.

For more help with how to use this code snippet in EG, you might consider contacting Tech Support.
cynthia
Ask a Question
Discussion stats
  • 1 reply
  • 107 views
  • 0 likes
  • 2 in conversation