BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
4 REPLIES 4
Flip
Fluorite | Level 6
Probably something like
if code = 21.1 then depth = depth*(-1);
prior to your sum.
deleted_user
Not applicable
That would only make the 21.1 a positve number increasing the total depth. i need to deduct 21.1 from the numbers below but once the number becomes positive then stop the sum and any codes that are a base, set them equal to zero then sum the leftover numbers from where the first sum stopped.
Flip
Fluorite | Level 6
I'm afraid that I am not following the logic you are trying to describe.
ChrisNZ
Tourmaline | Level 20
Your explanations are very obscure indeed.
[pre]
data SAMPLE;
infile cards missover;
do until(CODE=.);
input CODE DEPTH @;
output;
end;
input;
cards;
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
21.1 -2.75 8 1 40 1 6 .5 8 .75 40 6 8 2.75
run;

data SUMS;
set SAMPLE;
if SUM <0 then SUM+DEPTH; *add if negative;
else if CODE ne 40 then SUM+DEPTH; *else if positive add if not base;
if CODE=. then SUM=.; *reset between groups;
run;
.

yields for the last data line:
CODE DEPTH SUM
21.1 -2.75 -2.75
8.0 1.00 -1.75
40.0 1.00 -0.75
6.0 0.50 -0.25
8.0 0.75 0.50
40.0 6.00 0.50
8.0 2.75 3.25

unsure how you find 3.50

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 712 views
  • 0 likes
  • 3 in conversation