Published on :
Statistics INTERNAL_CREATION

Descriptive Analysis and Frequencies

This code is also available in: Deutsch Español Français
Awaiting validation
The script begins by creating a dataset named `function_study` containing participant information (ID, sex, disability, height, weight) using data directly embedded via the DATALINES clause. Then, it uses `PROC PRINT` to display all observations from the dataset. Finally, `PROC FREQ` is used to calculate the frequency and percentage distribution for the `disability` variable to determine the proportion of participants who reported a disability.
Data Analysis

Type : INTERNAL_CREATION


The `function_study` dataset is created directly within the script using the DATALINES clause, making the data self-contained and not dependent on external sources or SASHELP.

1 Code Block
DATA STEP Data
Explanation :
This DATA STEP block creates the `function_study` dataset using the data provided directly after the DATALINES statement. It defines the variables `id` (character), `sex` (character), `disability` (character), `ht_in` (numeric for height in inches) and `wgt_lbs` (numeric for weight in pounds).
Copied!
1/*
2Step 1. Highlight and sumbmit the data step below.
3*/
4DATA function_study;
5 INPUT id $ sex $ disability $ ht_in wgt_lbs;
6 DATALINES;
7 001 Male No 71 190
8 002 Female No 60 112
9 003 Female Yes 64 130
10 004 Female No 65 154
11 005 Male No 73 173
12 006 Male No 69 182
13 007 Female No 68 140
14 008 Male No 73 185
15 009 Male Yes 71 199
16 010 Male Yes 66 155
17 011 Male No 71 213
18 012 Female No 69 151
19 013 Female Yes 66 147
20 014 Female No 68 196
21 015 Male . 75 212
22 016 Female No 69 190
23 017 Female No 66 194
24 018 Male . 71 194
25 019 Female No 65 176
26 020 Female No 65 102
27RUN;
2 Code Block
PROC PRINT
Explanation :
This `PROC PRINT` procedure generates a report listing all observations (rows) and all variables (columns) from the `function_study` dataset. This is useful for a quick inspection of the data.
Copied!
1/*
2Step 2. Create a list report that shows all the observations in function_study.
3*/
4PROC PRINT DATA = function_study;
5RUN;
3 Code Block
PROC FREQ
Explanation :
This `PROC FREQ` procedure calculates the frequency and percentage distribution for the categorical variable `disability` in the `function_study` dataset. It helps determine the proportion of participants who reported a disability and visualize the distribution of this variable.
Copied!
1/*
2Step 3. Create a frequency report to calculate the percentage of participants who
3self-report having a disability.
4*/
5PROC FREQ DATA = function_study;
6 TABLE disability;
7RUN;
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.
Copyright Info : * ============================================================================; * Descriptive Analysis I * Practice: Calculate Frequencies and Percentages * This code is posted for your benefit; however, I highly recommend that you * practice typing your own SAS programs as well. With the SAS programming * language, as with all new languages, immersion seems to be the best way to * learn. * ============================================================================;