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!
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.
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.
Thank you!
Understand!
Thanks for the example!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.