The script begins by creating a 'height_and_weight_20' dataset using internal 'datalines'. It contains variables for ID, sex, height (ht_in), and weight (wgt_lbs). Then, it uses 'PROC MEANS' to calculate descriptive statistics (number of observations, mean, median, mode, standard deviation, minimum, maximum) for height and weight, with a precision of two decimal places. Comments in the original source code point out 'red flags' concerning missing data for weight and an impossible value (-69) for height.
Data Analysis
Type : INTERNAL_CREATION
Data is created directly in the script via a DATA STEP with `datalines`.
1 Code Block
DATA STEP Data
Explanation : This DATA STEP block creates the 'height_and_weight_20' dataset by reading raw data provided in the `datalines`. It defines four variables: `id` (character), `sex` (character), `ht_in` (numeric for height in inches), and `wgt_lbs` (numeric for weight in pounds). Missing values (periods) are present for sex and weight, and a clearly erroneous value (-69) is included for height, which is noted as a 'red flag' in the original comments.
Explanation : This 'PROC MEANS' procedure is used to calculate descriptive statistics for the variables `ht_in` and `wgt_lbs` from the `height_and_weight_20` dataset. The requested statistics are the number of observations (n), mean, median, mode, standard deviation (std), minimum (min), and maximum (max). The `maxdec=2` option limits the display of decimals to two digits.
Copied!
proc means data = height_and_weight_20 n mean median mode std min max maxdec=2;
var ht_in wgt_lbs;
run;
1
2
PROC MEANS
3
DATA = height_and_weight_20 n mean median mode std min max maxdec=2;
4
var ht_in wgt_lbs;
5
RUN;
6
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.