Help using Base SAS procedures

PROC SUMMARY concerning order.

Reply
N/A
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_);
run;

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?
Super Contributor
Posts: 259

Re: PROC SUMMARY concerning order.

Q1: No, the order depends on the class-variables natural order.
Q2: Yes.
Q3: Yes.
Q4: Yes.
Super Contributor
Super Contributor
Posts: 3,174

Re: PROC SUMMARY concerning order.

Consider this SAS documentation reference on MEANS/SUMMARY:

http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a000146737.htm#a000438726

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
SBBWorks,Inc.
Ask a Question
Discussion stats
  • 2 replies
  • 114 views
  • 0 likes
  • 3 in conversation