BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
PGStats
Opal | Level 21

Thank you Linlin!

H, I agree with Tom, don't worry about it.

PG

PG
TomKari
Onyx | Level 15

Yah, everybody who's important ALREADY knows that PG is a genius!

Tom

Astounding
PROC Star

While you could always extend the solution you have, here's another way:

data want;

   if _n_=1 then do;

      set have (where=(group=2) rename=(x1=x2 y1=y2));

      set have (where=(group=6) rename=(x1=x3 y1=y3));

   end;

   set have;

run;


Linlin
Lapis Lazuli | Level 10

data have;
input Group    : x1 y1;       
cards;
1               3  5                         
2               6  5                        
3               1  2                         
4               0  4                         
5               1  7                        
6               7  1                         
7               2  9
;
data _null_;
set have(where=(group in (2,6)));
call symputx(cats('x_group',group),x1);
call symputx(cats('y_group',group),y1);

data want;
  set have;
  x2=&x_group2;
  y2=&y_group2;
  x3=&x_group6;
  y3=&y_group6;
proc print;run;

Obs    Group    x1    y1    x2    y2    x3    y3
1          1        3     5     6     5     7     1
2          2        6     5     6     5     7     1
3          3        1     2     6     5     7     1
4          4        0     4     6     5     7     1
5          5        1     7     6     5     7     1
6          6        7     1     6     5     7     1
7          7         2     9     6     5     7     1

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 18 replies
  • 4868 views
  • 12 likes
  • 6 in conversation