Help using Base SAS procedures

Unique summing situation

Reply
N/A
Posts: 0

Unique summing situation

I need to sum data across a row (layers) say for a road surface.

P=Pavement
M=Milling
B=Base

Such as P .30, P 1.0, P 4.0, M -4.0, P 2.0, B .70, P 2.3. If P represented the data i needed to sum from left to right, subtracting the M from only the numbers past the M.

A. (P .30 + P 1.0 + P 4.0) = 5.30

B. (M -4.0 - P 2.0 + B .70 + P 2.3) = 1


A. + B. = 6.3
Respected Advisor
Posts: 3,900

Re: Unique summing situation

In order to get a good answer you should provide us with a sample data set (a SAS data step creating a SAS table) and then tell us how the result should look like.

As a general answer to your question:
Use an ARRAY and loop over it.
N/A
Posts: 0

Re: Unique summing situation

CODE DEPTH
20 1.00 45 9.00 21.1 -4.75 08 1.00 06 0.50 08 1.50
20 0.75 21.1 -2.2 08 1.50 20 0.50 21.2 -2.00 08 1.25
20 0.75 21.1 -2.25 08 1.50 21.2 -2.00 08 1.25 25 9.00

I NEED TO GO ACROSS THE ROW FROM LEFT TO RIGHT, BUT IT HAS TO STEP FROM LEFT TO RIGHT DEPTH ONE +- DEPTH TWO AND SO ON AND SO FORTH. I CAN'T USE A SUM BECAUSE IT WILL ADD EVERYTHING THE SUBTRACT THE -'S FROM THE TOTAL. IF THERE IS A NEG NUMBER NEAR THE END SAY -3.00 THEN 2.00 THERE WOULD BE -1.00 LEFT I NEED THAT TO DELETE THEN.
Ask a Question
Discussion stats
  • 2 replies
  • 115 views
  • 0 likes
  • 2 in conversation