Hello! I am a beginner SAS programmer and I am trying to update one of my datasets. I am trying to write code that will instruct SAS to search through a specific range of variables (Var1-Var200) in a dataset and look for a specific value (-87). If SAS finds that value present anywhere in that column, I want all the observations in that specific column to be replaced with that specified value. If possible, I would also like SAS to output a list of all the variables that were affected/updated. My current dataset looks like this: Var1 Var2 Var3 Var4 Var5 1 0 1 1 0 0 1 1 1 0 1 0 0 0 1 1 0 1 -87 1 0 0 0 1 0 I want to update the dataset to look like this: Var1 Var2 Var3 Var4 Var5 1 0 1 -87 0 0 1 1 -87 0 1 0 0 -87 1 1 0 1 -87 1 0 0 0 -87 0 If possible, I am hoping to also create an additional output saying something like: Variables that were updated Var4 I have tried using ARRAY and the FIND function to loop through the list of variables and update, but I don't know how to code it to update previous entries/rows of the dataset. I am also unsure how to write code that will output a list of the variables that were changed. data want; set have; array v Var1-Var200; do i=1 to dim(v); if find(v(i), '-87') ge 1 then v(i)='-87'; end; drop i; run; I appreciate any and all feedback! Thank you!
... View more