Hi y'all,
Please help create a group variable risk [i] in data step to my existing set of dataset.
where:
median of data is 300
risk[1]=300/3
risk[last]=300*3
by interval of 10.
The range has to be 300/3-300*3 with median of 300.
data temp; set agerisk;
array risk {i};
do i=1 to dim[risk];
...
end;
run;
@Cruise wrote:
Thanks a lot for getting back to me. I want:
risk val
1 100
2 200
3 300
4 400
5 500
6 600
7 700
8 800
9 900
10 1000
11 1100
12 1200
13 1300
14 1400
15 1500
That looks like you want to create a val as 100* risk. Which would be:
data want; do risk=1 to 15; val = Risk*100; output; end; run;
What am i doing wrong here? I simply want two variables created to the same number of rows in a new dataset?
data c.temp;
do risk=1 to 15 by 1;
do val=100 to 1500 by 100;
end;
end;
output;
run;
@Cruise wrote:
What am i doing wrong here? I simply want two variables created to the same number of rows in a new dataset?
data c.temp; do risk=1 to 15 by 1; do val=100 to 1500 by 100; end; end; output; run;
Hard to tell what you are doing wrong with out knowing what the output should look like.
But if you want output for each iteration the OUTPUT has to be inside one of the loops. likely
data c.temp; do risk=1 to 15 by 1; do val=100 to 1500 by 100; output; end; end; run;
@Cruise wrote:
Thanks a lot for getting back to me. I want:
risk val
1 100
2 200
3 300
4 400
5 500
6 600
7 700
8 800
9 900
10 1000
11 1100
12 1200
13 1300
14 1400
15 1500
That looks like you want to create a val as 100* risk. Which would be:
data want; do risk=1 to 15; val = Risk*100; output; end; run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: