suppose to have the following table:
ID Value A 234 B 231 C 223 D 167 E 57
And you know that the number of rows of another data set is "xxx", for example 1,234. Now, you want to divide each row ("Value" column) by the "xxx". I would like not to show explicitly the value of "xxx" because depending on the data set it could change. Desired output:
ID Value A 0.189 B 0.187 C 0.180 D 0.135 E 0.046
Can anyone help me please?
Given data like:
data have ;
input ID $1. Value ;
cards ;
A 234
B 231
C 223
D 167
E 57
;
data other ;
do id=1 to 1234 ;
output ;
end ;
run ;
You can use the SET statement with NOBS option to determine the number of records in OTHER.
data want ;
set have ;
if 0 then set other (drop=id) nobs=nobs ;
Value2=Value/nobs ;
run ;