BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
TomHsiung
Pyrite | Level 9

We use different statistics for continuous and category variables, respectively. We have to use two table statement. Is there any way to show them in one table? Thanks.

 

Code:

proc tabulate data = d202_raw;
title 'Summary of patient characterisitcs';
class AF gender smoker CHF DM Stroke Hypertension HFstage hypoalbuminemia RIFLE
indication1 CYP2C9 VKORC1
Amiodarone Statin Antiplatelets
;
var ageY wt bsa followUp
alb1 alb2 alb3 alb4 alb5
;
table
ageY
wt
bsa
followUp
alb1
alb2
alb3
alb4
alb5
, AF = 'Atrial fibrillation' * (N Mean STD Q1 Q3)
all = 'Overall' * (N Mean STD Q1 Q3);
table
gender
smoker
CHF
DM
Stroke
Hypertension
HFstage
hypoalbuminemia
RIFLE
indication1
CYP2C9
VKORC1
Amiodarone
Statin
Antiplatelets
, AF = 'Atrial fibrillation' * (N colpctn = '%')
all = 'Overall' * (N colpctn = '%')
;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ
Hi:
This looks like the type of demographic table that is typically generated either with a DATA step or with PROC REPORT. There have been many previous forums postings about how to generate this type of table. And, a lot of user group papers, too. If you search on www.lexjansen.com for "demographic tables" you will find a variety of papers on the topic.
Cynthia

View solution in original post

4 REPLIES 4
mkeintz
PROC Star

You want to know if you can form a table statement that generates one set of statistics for some rows (class vars) and other statistics for other rows (continuous vars).  

 

The answer is no.

 

But the greater question is why?  Are you trying to generate a specific sequence of variables in your report?

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
TomHsiung
Pyrite | Level 9
Thanks for the response and I solved the issue by %TABLEN macro.
Cynthia_sas
SAS Super FREQ
Hi:
This looks like the type of demographic table that is typically generated either with a DATA step or with PROC REPORT. There have been many previous forums postings about how to generate this type of table. And, a lot of user group papers, too. If you search on www.lexjansen.com for "demographic tables" you will find a variety of papers on the topic.
Cynthia
TomHsiung
Pyrite | Level 9
Hello, Cynthia

Thank you very much and now I am enjoying the %TABLEN macro, which is perfect for the demographic table generation.

Have a nice day!

https://www.lexjansen.com/pharmasug/2020/AD/PharmaSUG-2020-AD-088.pdf

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 346 views
  • 1 like
  • 3 in conversation