-
Notifications
You must be signed in to change notification settings - Fork 0
/
01_StandardDeviation.sas
64 lines (56 loc) · 1.76 KB
/
01_StandardDeviation.sas
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
54
55
56
57
58
59
60
61
62
63
64
/*
Author: Jan Vallee
Date: 18.03.2020
STANDARD DEVIATION (SD)
Description: gives the variation of answers -> SD = 0 in case all answers are equal
*/
*calculating SD - SD of all Items per Person*;
data SD_NoMissing;
set Data.P_HH;
array item AutonomyPT1-- ODMevaluation11; /* Creating an array of all Items to be tested */
do over item;
if item = 0 then item = .; /*Recoding no answer to "." to not influence the standard deviation */
end;
run;
data SD;
set SD_NoMissing;
sd = std(AutonomyPT1, SocialNormPT1, ExperiencePT2, BicycleOrientation1, ExperiencePT3, CarOrientation1, IntentionPT1, BicycleOrientation2, AutonomyPT2, ExperiencePT1,
IntentionPT2, ExperiencePT4, CarOrientation3, PersonalNormPT1, CarOrientation4, AutonomyPT4, BicycleOrientation3, WeatherResistance2, StatusCar1, StatusCar2, StatusCar3,
StatusCar7, StatusCar8, StatusCar12, StatusCar13, StatusCar14, StatusCar15, ODMevaluation1, ODMevaluation2, ODMevaluation3, ODMevaluation4, ODMevaluation5, ODMevaluation6,
ODMevaluation7, ODMevaluation8, ODMevaluation9, ODMevaluation10, ODMevaluation11); /*calculating the SD of given Items*/
run;
proc means data = SD; /*average of SD*/
var sd;
class CityHousehold;
output out = SD_City;
run;
proc export data = SD_City
outfile = "&path_data.\SAS_Export_New\Results.xlsx"
dbms = xlsx
replace;
sheet = "SD";
run;
/*Cut Offs*/
proc sort data = sd;
by CityHousehold;
run;
data test1;
set sd;
where CityHousehold = 8 AND sd = 0;
run;
data test2;
set sd;
where CityHousehold = 8 AND sd < 0.1;
run;
data test3;
set sd;
where CityHousehold = 8 AND sd < 0.3;
run;
data test4;
set sd;
where CityHousehold = 8 AND sd < 0.5;
run;
data test5;
set sd;
where CityHousehold = 8 AND sd < 1.0;
run;