BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DLROW
Quartz | Level 8

Hi , 

 

Please see below,

 

Proc sort data=sashelp.class out=cl1;
by age;
run;
data class;
set cl1;
by age;
if first.age then cnt+1;
run;
Proc report data=class nowd;
column cnt age sex, height;
define cnt / group;
define age / group;
define sex / across;
define height/analysis mean;
run;

When the above code is run I get the column names as

 

                                   sex

                        F                      M

Cnt  Age         Height              Height

 

I want the columns to be displayed as Cnt, Age, F, M . Please let me know how to  remove sex and Height from the layout.

 

Thanks.

 

 

1 ACCEPTED SOLUTION
4 REPLIES 4
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

remove height from you column statement

 

Proc sort data=sashelp.class out=cl1;
by age;
run;
data class;
set cl1;
by age;
if first.age then cnt+1;
run;
Proc report data=class nowd;
column cnt age sex;*, height;
define cnt / group;
define age / group;
define sex / across;
define height/analysis mean;
run;

 

DLROW
Quartz | Level 8

It doesn't work. If I remove height from the column statement then Mean of Height  is not displayed under the column M and F. Only the observation count is displayed. Thanks.

DLROW
Quartz | Level 8

Thank you, It works.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 2353 views
  • 0 likes
  • 3 in conversation