BookmarkSubscribeRSS Feed
lauraem93
Calcite | Level 5

Hello.

 

I am trying to create a single table with the same formatting as the id + by statement tables, where the id values are not repeated. For example

lauraem93_0-1651614724881.png

I want this to all be one table, not 2.

How do I do this?

1 REPLY 1
Reeza
Super User

One quick way is to switch to PROC REPORT and specify the BY variable as a GROUP variable instead.
You can also try specifying the ID variable the same as the BY variable and see if that resolves it as in this example: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n1dex816rlsynxn1gicri1elan89.htm#n1dex81...

EDIT:

proc sort data=sashelp.class out=class;
by sex;
run;

title 'PROC PRINT + BY';
proc print data=class;
by sex;
run;

title 'PROC PRINT + BY + ID';
proc print data=class;
id sex;
by sex;
run;

title 'PROC REPORT + GROUP';
proc report data=class;
column sex name age weight height;
define sex / group ;
define name / display;
define age / display;
define weight / display;
define height / display;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 557 views
  • 1 like
  • 2 in conversation