SWAP THE VALUES OF VARIABLES A AND B:
WE HAVE SAS DATA SET ONE;
DATA ONE;
X=5;
Y=3;
RUN;
CREATE ANOTHER SAS DATA SET TWO BY READING SAS DATA SET ONE:
TWO
----------
X Y
3 5
Now prepare your Base SAS and
Advance SAS Certification Exams with Online Mock tests: http://exam.sankhyana.com
For training related info kindly mail us at info@sankhyana.com
www.sankhyana.com
WE HAVE SAS DATA SET ONE;
DATA ONE;
X=5;
Y=3;
RUN;
CREATE ANOTHER SAS DATA SET TWO BY READING SAS DATA SET ONE:
TWO
----------
X Y
3 5
Now prepare your Base SAS and
Advance SAS Certification Exams with Online Mock tests: http://exam.sankhyana.com
For training related info kindly mail us at info@sankhyana.com
www.sankhyana.com
data two;
ReplyDeletelength X 3.;
set one
(rename=(X=Y Y=X));
RUN;
proc print data=two;
run;
IS IT RIGHT??
data two(drop=x y rename=(x1=X y1=Y) );
ReplyDeleteset one;
by x y;
if first.x then x1=3 ;
if first.y then y1=5;
run;
proc print data=two;
run;
data two;
ReplyDeleteset one;
temp=x;
x=y;
y=temp;
drop temp;
run;
data two(rename=(a=y b=x));
ReplyDeleteset one(rename= (x=a y=b));
run;
data two;
ReplyDeleteset one;
a=x;
b=y;
x=b;
y=a;
drop a b;
put _all_;
run;
data two;
ReplyDeleteset one;
X = X+Y;
Y= X-Y;
X = X - Y;
RUN;
data two(drop=X1 Y1);
ReplyDeleteset one;
X1=X;
Y1=Y;
X=Y1;
Y=X1;
run;
proc print data=two noobs;
run;