I'm trying to generate incremental data in a dataset based on a pattern.
For example I have a dataset with only 1 field and 1 record with value =2 and I want it to increment by 2 without replacing the old one.
Initial dataset:
-------------
count
2
My goal:
----------
2
4
6
8
10
The problem I am having is , when I write the code to generate the pattern, the new value (incremented ) replaces the old value so I only get 1 record.
Here's my code
data test;
num=1;
run;
data test1;
set test;
by num;
retain count 0;
if first.num then do;
count=count+2;
end;
run;
Once I get the code right, I will be replicating it to generate datetime fields from May 20 1980 to June 6 2008, with dates at 6 hours intervals captured one below the other in the dataset.
Thanks in advance.
Message was edited by: osho