BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I know this is going to be a BASIC question for everyone here but I have to ask it, so please forgive ... I'm a new user.

I am trying to do a basic Proc Means data extraction for a data set by certain fields needed for Survival Analysis. I am using the following code:

Proc Means N Median Min Max LCLM UCLM;
var ANC500;
Where Cens_ANC28 = 0;
CLASS BMTTYPE;
Run

This works fine, but what I also need to do is run the same with more than one Class so that it combines them (i.e. I could add "By Yr" to the top but that gives me for each year what the BMTTYPE was and I need the stats for them combined.). I tried to add two classes but it doesn't work, even though I see examples online of this process. I tried adding all of them to the Sort field and still nothing.

Anyone know what I am doing wrong?

TIA
3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Hi:
PROC MEANS allows you to specify 2 class variables on the CLASS statement, as shown in the code below.
[pre]
CLASS YR BMTTYPE;
[/pre]

In order to tell MEANS how to combine the CLASS variables, you would use either the TYPES or WAYS statement. For example:
[pre]
WAYS 1;
WAYS 0 1 2;
[/pre]

WAYS 1 would give you all the 1-way tables. While WAYS 0 1 2 would give you an overall summary, the 1-way tables and the 2-way tables. Without any other instructions from you, PROC MEANS is giving you the "highest" combination of the CLASS variables. If you want other levels of combination, you need to specify those levels. Here's some doc on the topic:
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a000222730.htm
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a000222729.htm
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a000146731.htm

cynthia
deleted_user
Not applicable
Where would the WAYS statement come in the syntax?
Doc_Duke
Rhodochrosite | Level 12
Unless the documentation specifies otherwise, anywhere between the PROC statement and the QUIT; or RUN; statement. Suggest you read all the documentation for PROC MEANS.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 882 views
  • 0 likes
  • 3 in conversation