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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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