Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add new observation to already created dataset in SAS?

Tags:

sas

How to add new observation to already created dataset in SAS ? For example, if I have dataset 'dataX' with variable 'x' and 'y' and I want to add new observation which is multiplication by two of the of the observation number n, how can I do it ?

dataX :
x y
1 1
1 21
2 3

I want to create :

dataX :
x y
1 1
1 21
2 3
10 210

where observation number four is multiplication by ten of observation number two.

like image 842
Qbik Avatar asked Dec 18 '25 03:12

Qbik


1 Answers

data X;
input x y;
datalines;
1 1
1 21
2 3 
;
run;



data X ;
set X end=eof;
if eof then do;
output;
x=10 ;y=210;
end;
output;
run;
like image 108
Sandy Avatar answered Dec 20 '25 17:12

Sandy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!