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
Diamond | Level 26
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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 864 views
  • 0 likes
  • 2 in conversation