How to replace if the value is 1 with the below row value "Weight" find the below image current data set and the final output required,
please any one help how to get the final required dataset
Why did you post photographs of 25 numbers? Wouldn't it have been easier to just type (or paste) the numbers directly into your question? It certainly would be easier to deal with.
First step is the split the original mish-mash into two datasets. One with the actual employee data. And the other with the WEIGHT data. Now you can combine them. It looks like you just want to multiple the value of TEST1 times the value of WEIGHT1, TEST2 times the value of WEIGHT2 etc. Do not attempt to add the extra row back into the result. If you need to re-create your photograph do that as a report.
Plz post the data step code ,NOT picture , nobody would like to type it for you.
data have;
input id $ test1-test4;
cards;
1 0 0 0 1
2 1 0 0 0
3 0 0 1 0
4 0 0 0 0
weight 1.412 0.207 0.207 0.207
;
data want;
set have;
if _n_=1 then set have(keep=test1-test4
rename=(test1-test4=t1-t4)) point=nobs nobs=nobs;
array x{*} test1-test4;
array y{*} t1-t4;
do i=1 to dim(x);
if x{i} then x{i}=y{i};
end;
drop i t1-t4;
run;
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.