BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi!

I'm just starting with SAS (8.2) and I was wondering how to calculate % in a table.
For example, I have 8 individuals (ident) with a number of observations for each for the variable "height". In my table, I would like to have the n, plus the % of observations corresponding to that n for each individuals, with the total of obs. at the end. Also, how could I do the same thing, but with another variable (month). For example, I want to know how many "height=8m" occurred in july, august, etc... (n and corresponding %)?

Thank you so much!
3 REPLIES 3
David_SAS
SAS Employee
Are all of the variables classification variables? Then
try:
[pre]
proc tabulate data=yourdata;
class ident height month;
table ident month, height*(n colpctn rowpctn);
run;
[/pre]
That will calculate column and row percentages. Choose whichever you like.

-- David Kelley, SAS
deleted_user
Not applicable
ok thanks! It is giving me the "general" n and %, but is there a way to get the n and % for each value (10 different) for the variable height, for ident and month? like n and % for height=8m in july for example...

thanks again!
MS
David_SAS
SAS Employee
I recommend that you contact Technical Support with your question. See http://support.sas.com/techsup/contact/submit_emits2.html .

-- David Kelley, SAS

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

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