08-15-2016 03:14 PM
For this dataset only variable A is populated ,I want to create 2 variables date and periods as shown in the excel.The code should be such that once i specify the start date and end date,it should generate all the quarters and their corresponding period starting from zero.In this dataset variable A has 42 values,so if i specify start date as 31-dec-2015 and end date as 31-dec-2020,it should generate all the inbetween quarters as shown in image and also their corresponding quartes.it should also repeat iti.e if Variable A has 42 values it should repeat it twice(42/21)
08-15-2016 03:23 PM
Do you have the possiblity where a value for the A variable might duplicate a previous value but not be the start of a duplicate set?
What is the largest number of values that might be involved with a sequence in A?
08-16-2016 01:50 PM
08-16-2016 02:00 PM
Well, without sample input data (I'm not going to type out your data from a picture) I think the code provided initially is a good start.
If you've tried it, please post what you've tried and what doesn't work.
08-15-2016 03:24 PM
How are you providing your start/end date. That looks like output, what does your input look like.
What you should be doing is sketched out below - untested.
1. Finding the number of periods you need to create by using your start/end date with the INTCK function
num_quarters = intck('QTR', start_date, end_date);
2. Loop over the number of quarters and increment date
do i= 1 to num_quarters; date = intnx('Quarter', start_date, i, 'b'); OUTPUT; end;
08-16-2016 02:02 PM
To me only the dataset with variable A is populated.I have been told that start date is 31-Dec-2015 and end date is 31-dec2020.
I have to create a dates coloumn such that all the 21 quarters are populated in a manner as shown in the image file.along with that i have to create a period coloumn as shown in the image