Help using Base SAS procedures

PROC SUMMARY concerning order.

Not applicable
Posts: 0

PROC SUMMARY concerning order.

A data set, POPULATION, with 2 variables: COUNTRY(=any of 50 countries) and GENDER={F, M}.

My code:

proc summary data=population nway order=freq;
class country gender;
output out=outpop(drop=_type_);

Is it the total number of people (F+M) that gives the order in data set OUTPOP?

E.g. If there were only 3 countries X, Y, Z: Country X with 1 M and 100 000 F, country Y with 90 000 M and 10 000 F, country Z with 50 000 M and 50 000 F, then will the order be:

Country Gender _FREQ_
X F 100000
X M 1
Y F 10000
Y M 90000
Z F 50000
Z M 50000

Q1: Is it the total number of persons in each country that decides the ordering?

Q2: Will each countrys two records always be kept together regardless of the numbers of different genders?

Q3: Y and Z have both total 100000. Is country Y positioned before country Z because Y comes before Z in the alphabet?

Q4: And are females always positioned before men because F comes before M in the alphabet, regardless of the number of individual persons?
Valued Guide
Posts: 631

Re: PROC SUMMARY concerning order.

Posted in reply to deleted_user
Q1: No, the order depends on the class-variables natural order.
Q2: Yes.
Q3: Yes.
Q4: Yes.
Super Contributor
Super Contributor
Posts: 3,176

Re: PROC SUMMARY concerning order.

Posted in reply to andreas_lds
Consider this SAS documentation reference on MEANS/SUMMARY:

Also, I'm convinced you could answer some of these questions by observing the SAS system execution - consider using the SASHELP.CLASS file if none is available.

Scott Barry
Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation