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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.