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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 6894 views
  • 12 likes
  • 6 in conversation