N/A
Posts: 0

# Complex Calculations

Maybe you could help me with my next problem. I need to manipulate the data generated from the output that you helped with. RMS{i}=21.1 is a code associated with a negative number (i.e. - 2.75). I need to subtract that number from the codes below.

Code
21.1 = Milling (Always Subtracted)
06 = Pavement (Always Added)
08 = Pavement (Always Added)
40 = Base (Ignored except when below milling)

Senario 1
Instance Code Depth
1 21.1 -2.75
2 08 1.00 2.1=sum(1:2) -1.75
3 40 1.00 3.1=sum(2.1:3) -0.75
4 06 0.50 4.1=sum(3.1:4) -0.25
5 08 0.75 5.1=sum(4.1:5) 0.50
6 40 6.00 6.1=sum(5.1:6) 0.50
7 08 2.75 7.1=sum(6.1:7) 3.25

Output = 3.50 Total Depth

Code So Far

DATA MILL1 ;
SET MILLA8;
BY CNTY SR SEG BEG_OFF;
ARRAY DPT{29} LAY_DT1-LAY_DT29;
ARRAY PAV{29} PAV_ST1-PAV_ST29;
ARRAY RMS{29} RMS_CD1-RMS_CD29;

DEPTH=0;
CODE=0;
flag = 0; * Reset flag;

OFF_LEN=END_OFF-BEG_OFF;
IF LAY_CD1='BRDK' OR LAY_CD2='BRDK' THEN DELETE;

DO I=1 TO 29 BY 1 UNTIL (CODE=21.2);
if RMS{i}=21.1 then flag = 1;
IF PAV{i} NE 'W' and flag = 1 THEN DO; *Starts processing after flag is set;
DEPTH=DPT{i}; CODE=RMS{i};
IF CODE=. THEN DELETE;
IF CODE=21.2 THEN DEPTH=0;
output;
END;
END;
RUN; Message was edited by: cpjeep
Discussion stats
• 0 replies
• 191 views
• 0 likes
• 1 in conversation