-
Notifications
You must be signed in to change notification settings - Fork 7
/
Graph_asgt_w4
53 lines (42 loc) · 1.8 KB
/
Graph_asgt_w4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* Author - Anupama Rajaram
Function - Calculate frequency distribution for research questions
Importing data from a file called "anu_ool_pds-w3.csv
this file has 290 rows. Values stored in object call "temp_chk"
*/
data temp_chk;
infile " /home/sunyblogger0/sasuser.v94/anu_ool_pds-w5.csv"
DELIMITER=',' ;
Input CASEID W1_CASEID W2_CASEID2 PPAGECAT W1_F3 W1_F4_B W1_F4_D W1_F5_A W1_F6;
/* Giving labels to variable names for better understanding */
LABEL CASEID = "Case Number"
W1_F3 = "Belief in achieving American Dream"
W1_F4_B = "Achieving financially secure retirement"
W1_F4_D = "Achieving wealth"
W1_F5_A = "Owning a home"
W1_F6 = "How close to achieve the American Dream";
/* Coding for missing values as part of Data Management */
IF W1_F3 = -1 THEN W1_F3 = .;
IF W1_F4_B = -1 THEN W1_F4_B = .;
if W1_F4_D = -1 then W1_F4_D =.;
IF W1_F5_A = -1 THEN W1_F5_A =.;
IF W1_F6 = -1 THEN W1_F6 =.;
/* Only considering participants in age range 25-34 */
IF PPAGECAT=2;
/* CREATING A COMPOUND VARIABLE - wealth_conf */
WEALTH_CONF = SUM (OF W1_F4_B W1_F4_D);
IF W1_F4_B =. OR W1_F4_D = . THEN WEALTH_CONF = .;
/* The command above ensures that if values for either
of the two variables are missing, then the wealth_conf
is also coded as "." or missing. */
LABEL WEALTH_CONF = "Confidence to achieve wealth and secure retirement";
/* PRINTING THE INDIVIDUAL VARIABLES TO VIEW WEALTH CONFIDENCE
this part of the code is currently commented out */
/* PROC PRINT; VARIABLES W1_F4_B W1_F4_D WEALTH_CONF ; */
/* Computing frequency distribution for 5 variables
PROC FREQ DATA = temp_chk;
TABLES WEALTH_CONF W1_F4_B W1_F4_D W1_F3 W1_F4_B W1_F6;*/
/* creating bar graph chart for varibale wealth_conf */
PROC GCHART; VBAR W1_F4_B/discrete ;
run;
PROC FREQ DATA = temp_chk;
TABLES W1_F4_B;