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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 670 views
  • 0 likes
  • 2 in conversation