forked from CMAP-REPOS/mrn_programs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathverify_node_coords.sas
81 lines (72 loc) · 1.99 KB
/
verify_node_coords.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* VERIFY_NODE_COORDS.SAS
Nick Ferguson
Created 05/01/13
Last Revised 05/01/13
INPUT:
- Reads temp_arcstart.dbf to get updated anode coordinates.
- Reads temp_arcend.dbf to get updated bnode coordinates.
OUTPUT:
- If there are nodes with multiple coordinate pairs,
verify_node_coords.lst is created to list them.
REVISIONS:
---------------------------------------------------------------*/
%let dir=&sysparm; ***shapefile storage directory;
*** READ IN BEGINNING NODES ***;
proc import datafile="&dir.\Temp\temp_arcstart.dbf" out=a0 replace;
data a(keep=anode bnode point_x point_y);
set a0;
proc sort;
by anode bnode;
*** READ IN ENDING NODES ***;
proc import datafile="&dir.\Temp\temp_arcend.dbf" out=b0 replace;
data b(keep=anode bnode point_x point_y);
set b0;
proc sort;
by anode bnode;
filename nwmi "&dir.\Temp\new_mile.dbf";
%macro ignore_split_ends;
%if %sysfunc(fexist(nwmi)) %then %do;
*** READ IN SPLIT LINKS ***;
proc import datafile="&dir.\Temp\new_mile.dbf" dbms=dbf out=split replace;
proc sort;
by anode bnode;
data chk1;
merge a split;
by anode bnode;
data chk1;
set chk1;
where tempa < 90000;
data chk2;
merge b split;
by anode bnode;
data chk2;
set chk2;
where tempb < 90000;
%end;
%else %do;
data chk1;
set a;
data chk2;
set b;
%end;
%mend ignore_split_ends;
%ignore_split_ends
*** VERIFY EACH NODE HAS ONLY ONE SET OF COORDINATES ***;
data chk1;
set chk1;
node=anode;
data chk2;
set chk2;
node=bnode;
data chk3;
set chk1 chk2;
proc summary nway;
class node point_x point_y;
output out=chk;
proc freq data=chk;
tables node / noprint out=chk0;
data chk0;
set chk0(where=(count>1));
proc print;
title "These Nodes Have Multiple Coordinate Pairs";
title2 "Edit the Network and Snap them Together";