Published on :
Data Analysis CREATION_INTERNE

Survey Response Analysis

This code is also available in: Deutsch Español Français
Awaiting validation
This SAS© script creates a dataset named 'Survey_Responses'. It defines five alphanumeric variables (QUES1 to QUES5) to store survey responses, each with specific lengths. The data is directly provided within the script via a DATALINES block. Then, PROC FREQ is used to generate frequency tables for each question (QUES1 to QUES5), without displaying cumulative percentages (NOCUM option).
Data Analysis

Type : CREATION_INTERNE


The survey data is created directly within the SAS script using the DATALINES statement, meaning it does not come from external files or existing SAS libraries (other than base data provided by SASHELP, which is not used here).

1 Code Block
DATA STEP Data
Explanation :
This DATA STEP block creates a new dataset named 'Survey_Responses'. The 'input' statement defines five alphanumeric variables (QUES1 to QUES5) with their maximum lengths. The 'datalines' block marks the beginning of the raw data that will be read line by line to populate the dataset. Each line represents an individual's responses to the survey.
Copied!
1DATA Survey_Responses;
2 INPUT QUES1 $1 QUES2 $2 QUES3 $3 QUES4 $4 QUES5 $5;
3 
4DATALINES;
5ABCDE
6AACCE
7BBBBB
8CABDA
9DDAAC
10CABBB
11EEBBB
12ACACA
13;
2 Code Block
PROC FREQ
Explanation :
This block executes the PROC FREQ procedure to calculate the frequency distribution of responses for variables QUES1 to QUES5. The 'tables QUES1 - QUES5' statement indicates to analyze all variables from QUES1 to QUES5. The '/ nocum' option suppresses the display of cumulative frequencies in the output table.
Copied!
1PROC FREQ;
2 tables QUES1 - QUES5 / nocum;
3RUN;
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.