-
Notifications
You must be signed in to change notification settings - Fork 1
/
SAS CODE_ Transpose Individual NSWA Display Seq.sas
67 lines (58 loc) · 1.75 KB
/
SAS CODE_ Transpose Individual NSWA Display Seq.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
65
66
67
proc import datafile="F:\BDI\BDISP\ETL\10_NSW\1000_Source_Data\AMBULANCE\eMR - 6 Primary Survey.csv"
out=PRISURVEY_1
dbms=csv
replace;
getnames=yes;
delimiter = '|';
run;
proc sort data=PRISURVEY_1;
by EPCR_ID display_sequence;
run;
proc transpose data= PRISURVEY_1
out= PRISURVEY_SUMM (drop=_NAME_)
prefix=pri_survey_summ_;
by EPCR_ID;
id DISPLAY_SEQUENCE;
var PRIMARY_SURVEY_SUMMARY;
run;
proc transpose data= PRISURVEY_1
out= PRISURVEY_NAME (drop=_NAME_)
prefix=pri_survey_name_;
by EPCR_ID;
id DISPLAY_SEQUENCE;
var PRIMARY_SURVEY_NAME;
run;
proc sql;
create table WORK.PRI_SURVEY_TRANS as
select t1.EPCR_ID,
t1.pri_survey_name_1,
t1.pri_survey_name_2,
t1.pri_survey_name_3,
t1.pri_survey_name_4,
t1.pri_survey_name_5,
t1.pri_survey_name_6,
t1.pri_survey_name_7,
t1.pri_survey_name_8,
t1.pri_survey_name_9,
t1.pri_survey_name_10,
t1.pri_survey_name_11,
t1.pri_survey_name_12,
t1.pri_survey_name_13,
t1.pri_survey_name_14,
t2.pri_survey_summ_1,
t2.pri_survey_summ_2,
t2.pri_survey_summ_3,
t2.pri_survey_summ_4,
t2.pri_survey_summ_5,
t2.pri_survey_summ_6,
t2.pri_survey_summ_7,
t2.pri_survey_summ_8,
t2.pri_survey_summ_9,
t2.pri_survey_summ_10,
t2.pri_survey_summ_11,
t2.pri_survey_summ_12,
t2.pri_survey_summ_13,
t2.pri_survey_summ_14
from WORK.PRISURVEY_NAME t1
inner join WORK.PRISURVEY_SUMM t2 on (t1.EPCR_ID = t2.EPCR_ID);
quit;