Hi,
I need help creating a program that generates the following series:
-> My database is composed of 84 series of SKUs each containing 114 rows.
-> And 84 series of DemandaSKU that also contain 114 rows.
What I need is to generate a matrix (114,84) that in the fields has the following number:
The sum of how many rows in demandasku fit in stock?
Example: For row 1 of sku1 what is the number of rows of demandasku summed up to the value of row 1 sku1?
Generate special series problem
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
karakilamaravilla
- Posts: 24
- Joined: Tue Jun 13, 2017 12:04 pm
Generate special series problem
- Attachments
-
- días piso reales.wf1
- (219.87 KiB) Downloaded 311 times
-
EViews Matt
- EViews Developer
- Posts: 584
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Generate special series problem
Hello,
Some clarification is needed. When you say "number of rows of demandasku summed up", do you mean initial rows, i.e., always start summing a column of demandasku from row 1?
Some clarification is needed. When you say "number of rows of demandasku summed up", do you mean initial rows, i.e., always start summing a column of demandasku from row 1?
-
karakilamaravilla
- Posts: 24
- Joined: Tue Jun 13, 2017 12:04 pm
Re: Generate special series problem
Dear,Hello,
Some clarification is needed. When you say "number of rows of demandasku summed up", do you mean initial rows, i.e., always start summing a column of demandasku from row 1?
As an example,
For SKU1 row 1: How many rows of DemandSKU1 (from row 1 to row) add at most the amount of row 1 of SKU1.
For SKU1 row 2: How many rows of DemandSKU1 (from row 2 through n) add at most the amount of row 2 of SKU1.
N depends on when the target is reached in the sum.
-
EViews Matt
- EViews Developer
- Posts: 584
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Generate special series problem
I believe the following generates the first column of the results matrix you want (which I've called m). You can double check the results and generalize the code to all columns.
Code: Select all
matrix(@obsrange, 1) m
for !i = 1 to @obsrange
%smpl = @str(!i) + " " + @str(@obsrange)
series tmp = @cumsum(demandasku1, %smpl) <= @elem(sku1, !i)
m(!i, 1) = @sum(tmp)
next
-
karakilamaravilla
- Posts: 24
- Joined: Tue Jun 13, 2017 12:04 pm
Re: Generate special series problem
Dear Matt,
Your response was 100% satisfactory. How can I close the question, I am new here in this forum.
Thank you very much for your help.
Your response was 100% satisfactory. How can I close the question, I am new here in this forum.
Thank you very much for your help.
-
EViews Matt
- EViews Developer
- Posts: 584
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Generate special series problem
I'm glad that worked for you. There's no procedure for closing threads in this forum, they remain open for future inquiries from anyone.
Who is online
Users browsing this forum: No registered users and 2 guests
