Is it possible? Almost anything is possible.
Do I know what you're trying to do? No!
Can one write code that produces what you want? Of course!
data have;
input x $ y z;
cards;
aa 11 101
bb 14 201
cc 13 303
dd 12 404
dd 17 505
;
data x(keep=x) y(keep=y y1) z(keep=z z1);
set have;
select (_n_);
when (1) do;
y1=4;
z1=1;
end;
when (2) do;
y1=3;
z1=3;
end;
when (3) do;
y1=5;
z1=4;
end;
when (4) do;
x='aa';
y1=1;
z1=5;
end;
otherwise do;
y1=2;
z1=2;
end;
end;
run;
proc sort data=x;
by x;
run;
proc sort data=y;
by y1;
run;
proc sort data=z;
by z1;
run;
data want (keep=x y z);
set x;
set y;
set z;
run;
Art, CEO, AnalystFinder.com
Hi Praveen
I think you'll have to give us some more detail about the logic you want to use in order to get an answer to this
I dont see the logic here, please provide more information.
Is it possible? Almost anything is possible.
Do I know what you're trying to do? No!
Can one write code that produces what you want? Of course!
data have;
input x $ y z;
cards;
aa 11 101
bb 14 201
cc 13 303
dd 12 404
dd 17 505
;
data x(keep=x) y(keep=y y1) z(keep=z z1);
set have;
select (_n_);
when (1) do;
y1=4;
z1=1;
end;
when (2) do;
y1=3;
z1=3;
end;
when (3) do;
y1=5;
z1=4;
end;
when (4) do;
x='aa';
y1=1;
z1=5;
end;
otherwise do;
y1=2;
z1=2;
end;
end;
run;
proc sort data=x;
by x;
run;
proc sort data=y;
by y1;
run;
proc sort data=z;
by z1;
run;
data want (keep=x y z);
set x;
set y;
set z;
run;
Art, CEO, AnalystFinder.com
Is it possible? Almost anything is possible.
Do I know what you're trying to do? No!
Can one write code that produces what you want? Of course!
@art297 I love your sense of humor. I hope you are having a great weekend!
This is an excellent response, and should be marked as the solution.
it's so good, we don't need to know what the problem is. ... and we don't.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.