开发者

How to create a sas dataset with one variable where each value is increased by a constant step?

开发者 https://www.devze.com 2023-03-09 20:48 出处:网络
This would be a junior sas question. I have a lower bound, say, 1 and an upper bound, say, 10 and I want t开发者_如何学Co create a dataset with a single variable, with 10 observations from 1 to 10, st

This would be a junior sas question. I have a lower bound, say, 1 and an upper bound, say, 10 and I want t开发者_如何学Co create a dataset with a single variable, with 10 observations from 1 to 10, step at 1. How can I do this convinently in sas? Thanks for any help.


Is this what you're after?:

data count;
    do i = 1 to 10;
        output;
    end;
run;


If you want to increment by a value diffrent 1 use the BY syntax.
In the following example you would get 5 observations with values of i like 1 3 5 7 9

data count;
    do i = 1 to 10 by 2;
        output;
    end;
run;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号