BookmarkSubscribeRSS Feed
m_u_r_a_l_i
Calcite | Level 5
Hi,

I am using the N statistic in one of my requirement.

My i.p files look like the one below :

ID Name
1111 Murali
2222 Nick

ID DESCRIPTION
1111 Description 1
2222 Description 2

The final report which I try to bring out of PROC REPORT looks like this :

ID DESCRIPTION N
1111 DESCRIPTION 1 2
2222 DESCRIPTION 2 1

Column N indicates, the number of records for each ID.

The PROC REPORT i coded was :

PROC REPORT DATA=MERGED NOCENTER NOWD HEADLINE HEADSKIP MISSING;
COLUMN ID NAME N;
DEFINE SDC / GROUP FORMAT=£4. 'ID';
DEFINE SDCDESC / GROUP FORMAT=£40. 'NAME';

Everything works fine. But the third column heading is coming up as 'N'. I want it to be TOTAL. I am not sure how I can change it.

I want the report to be :

ID DESCRIPTION TOTAL
1111 DESCRIPTION 1 2
2222 DESCRIPTION 2 1

I would be very very happy if someone can help in this.

Thanks....
3 REPLIES 3
deleted_user
Not applicable
Your column definition :
DEFINE SDCDESC / GROUP FORMAT=£40. 'NAME'
will name the column with a label of "NAME", not "DESCRIPTION". Be careful when copying or creating dummy code that you don't lose the sense.

The quoted value will label the column, and providing a definition for the N column will give you the column label you require.

Kind regards

David
m_u_r_a_l_i
Calcite | Level 5
Hey,

Thanks Daniel. Please find the correct one below :
PROC REPORT DATA=MERGED NOCENTER NOWD HEADLINE HEADSKIP MISSING;
COLUMN ID NAME N;
DEFINE ID / GROUP FORMAT=£4. 'ID';
DEFINE NAME / GROUP FORMAT=£40. 'NAME';

Now when I define, N, it says N is not a part of the MERGED dataset ! So it doesnt work if I define N.
m_u_r_a_l_i
Calcite | Level 5
Sorryyyyy.

It worked !

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 727 views
  • 0 likes
  • 2 in conversation