BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Is it possible to move the record count that comes out at the bottom of a report to the Title? or top of report?
1 REPLY 1
Cynthia_sas
SAS Super FREQ
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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 654 views
  • 0 likes
  • 2 in conversation