Help using Base SAS procedures

A Basic Procedure Request

Reply
N/A
Posts: 0

A Basic Procedure Request

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
SAS Super FREQ
Posts: 8,743

Re: A Basic Procedure Request

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
N/A
Posts: 0

Re: A Basic Procedure Request

Where would the WAYS statement come in the syntax?
Trusted Advisor
Posts: 2,113

Re: A Basic Procedure Request

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.
Ask a Question
Discussion stats
  • 3 replies
  • 211 views
  • 0 likes
  • 3 in conversation