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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 1210 views
  • 0 likes
  • 2 in conversation