- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 11-12-2022 03:04 PM
(620 views)
I want to create a dataset that have three variables(customer_num, total_bads, and current_bads). For every observation I want current_bads =customer_num and total_bads is then deducted by the number of current_bads until total_bads =0
For example(the initial total_bads is 60):
Customer_num Current_bads Total_bads
19 19 41
10 10 31
25 25 6
20 6 0
30 0 0
15 0 0
I am trying to use loop but my code doesn’t stop when total_bads reaches 0.
Can someone help me with it? Thank you such!
For example(the initial total_bads is 60):
Customer_num Current_bads Total_bads
19 19 41
10 10 31
25 25 6
20 6 0
30 0 0
15 0 0
I am trying to use loop but my code doesn’t stop when total_bads reaches 0.
Can someone help me with it? Thank you such!
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Show the code you tried.
Show the result you want.
Take the time to convert the data into code that create a dataset so those that want to help don't have to type in your numbers.
Notice it is not actually any more work than you already did to post the listing of the data.
data have;
input Customer_num Current_bads Total_bads;
cards;
19 19 41
10 10 31
25 25 6
20 6 0
30 0 0
15 0 0
;