data have;
input num1 num2;
datalines;
1 2
4 3
7 9
11 10
;
run;
output
num1 num2 num3
1 2 2
4 3 4
7 9 9
11 10 11
@aanan1417 wrote:
num3 should have bigger value from num1 or num2
data want;
set have;
num3=max(num1,num2);
run;
Please explain further what you are doing. What is the logic that takes the input data in data set named HAVE and produces the output?
num3 should have bigger value from num1 or num2
@aanan1417 wrote:
num3 should have bigger value from num1 or num2
data want;
set have;
num3=max(num1,num2);
run;
Have a look at the documentation of the max function: https://documentation.sas.com/doc/de/pgmsascdc/9.4_3.4/lefunctionsref/n00bjr4jof59pwn1bfzk9f5i0ujr.h...
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.
Ready to level-up your skills? Choose your own adventure.