BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jc3992
Pyrite | Level 9

Hello everyone,

 

The code provided by our instructor was as below:

 

PROC TABULATE DATA = boats;
   CLASS Port Locomotion Type;
   TABLE Port, Locomotion*Type;
   TITLE 'Number of Boats by Port, Locomotion, and Type';
RUN;

Under "Table" command,

The "," (comma) means "crossing", and the "*"( the asterisk) means "nesting"

I am a bit confused about these two concepts.

I know "crossing" is like row and column,

but what about "nesting"?

Is there anybody would like to elaborate a little bit for me?

 

Thank you very much!

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Nesting means to for each level of Locomotion each level of type will have a column or row of output (depending on which dimension the nested expression is in.

 

If you have a data set run the code.

Or look at this with a data set you should have:

proc tabulate data=sashelp.class;
   class sex age;
   var height weight;
   tables sex*age,
          height*max weight*mean;
run;

which generates rows of data having age values within sex values. Note that M has a row for age 16 but F doesn't as there aren't any values of age=16 for females in that data set.

 

A secondary form of nesting involves the STATISTICS choices. The example above shows one statistic for height and weight. Using parentheses we can specify multiple statistics "nested" for an analysis variable:

proc tabulate data=sashelp.class;
   class sex age;
   var height weight;
   tables sex*age,
          (height weight) * (mean max);
run;

Requests mean and maximum values for both height and weight.

 

View solution in original post

2 REPLIES 2
ballardw
Super User

Nesting means to for each level of Locomotion each level of type will have a column or row of output (depending on which dimension the nested expression is in.

 

If you have a data set run the code.

Or look at this with a data set you should have:

proc tabulate data=sashelp.class;
   class sex age;
   var height weight;
   tables sex*age,
          height*max weight*mean;
run;

which generates rows of data having age values within sex values. Note that M has a row for age 16 but F doesn't as there aren't any values of age=16 for females in that data set.

 

A secondary form of nesting involves the STATISTICS choices. The example above shows one statistic for height and weight. Using parentheses we can specify multiple statistics "nested" for an analysis variable:

proc tabulate data=sashelp.class;
   class sex age;
   var height weight;
   tables sex*age,
          (height weight) * (mean max);
run;

Requests mean and maximum values for both height and weight.

 

jc3992
Pyrite | Level 9

Thank you!

Understand!

 

Thanks for the example!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 2336 views
  • 1 like
  • 2 in conversation