The script internally initializes a dataset named 'Turnip' via a DATALINES block. This dataset contains calcium concentration measurements structured by 'Plant' and 'Leaf', with multiple 'Sample' per 'Leaf'. Subsequently, the PROC NESTED procedure is applied to this dataset. It is configured to model the nested classification factors 'plant' and 'leaf' and to analyze the 'calcium' response variable, allowing for the estimation of variance components associated with each nesting level.
Data Analysis
Type : INTERNAL_CREATION
The 'Turnip' dataset is entirely created within the SAS script using a DATALINES block to provide raw calcium concentration data. No external data sources or pre-existing SAS libraries (like SASHELP) are used for input data.
1 Code Block
DATA STEP Data
Explanation : This DATA block creates the 'Turnip' dataset. It uses nested loops to generate observations representing 4 'Plant's, 3 'Leaf's per plant, and 2 'Sample's per leaf. The 'Calcium' variable is read sequentially from the numeric values provided in the DATALINES block, thus populating the dataset with the specified hierarchical structure.
Copied!
data Turnip;
do Plant=1 to 4;
do Leaf=1 to 3;
do Sample=1 to 2;
input Calcium;
output;
end;
end;
end;
datalines;
3.28 3.09 3.52 3.48 2.88 2.80 2.46 2.44
1.87 1.92 2.19 2.19 2.77 2.66 3.74 3.44
2.55 2.55 3.78 3.87 4.07 4.12 3.31 3.31
;
1
DATA Turnip;
2
DO Plant=1 to 4;
3
DO Leaf=1 to 3;
4
DO Sample=1 to 2;
5
INPUT Calcium;
6
OUTPUT;
7
END;
8
END;
9
END;
10
DATALINES;
11
3.283.093.523.482.882.802.462.44
12
1.871.922.192.192.772.663.743.44
13
2.552.553.783.874.074.123.313.31
14
;
2 Code Block
PROC NESTED
Explanation : This PROC NESTED procedure is executed on the 'Turnip' dataset to perform a variance component analysis. The 'plant' and 'leaf' variables are declared as nested classification ('class') variables, meaning that leaves are considered nested within plants. The 'calcium' variable is defined as the response ('var') variable whose variability is analyzed. The procedure calculates variance component estimates for each nested factor, helping to understand the sources of calcium variation.
Copied!
proc nested data=Turnip;
class plant leaf;
var calcium;
run;
1
PROC NESTEDDATA=Turnip;
2
class plant leaf;
3
var calcium;
4
RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.