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!
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.