🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 05-29-2020 05:08 AM
(814 views)
Obs p
1 1
2 1
3 1.2
4 1
5 1.3
6 1
7 1
8 1.5
I want to this output,how can I calculate continuous multiplication?
Thanks!
Obs p cump
1 1 1
2 1 1(=1*1)
3 1.2 1.2(=1.2*1)
4 1 1.2(=1*1.2)
5 1.3 1.56(=1.3*1.2)
6 1 1.56
7 1 1.56
8 1.5 2.34(1.5*1.56)
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @yuwentaiwan
Please try this:
data have;
input Obs p;
datalines;
1 1
2 1
3 1.2
4 1
5 1.3
6 1
7 1
8 1.5
;
run;
data want;
set have;
retain cump 1;
cump = cump*p;
run;
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @yuwentaiwan
Please try this:
data have;
input Obs p;
datalines;
1 1
2 1
3 1.2
4 1
5 1.3
6 1
7 1
8 1.5
;
run;
data want;
set have;
retain cump 1;
cump = cump*p;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks!!:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You're welcome @yuwentaiwan !