I'm on SAS EG 5.1. One possible way to define variables by cases is, for instance, Variable=2*(Statement 1)+3*(Neg of Statement 1); What is this called? I'd like to read about it, but I don't know what words to search for. Now please consider the following code. %MACRO CYCLE;
%DO A=1 %TO 2;
%PUT &A.;
%LET B=0.636805089257504*(&A.=1)+0.656423671305948*(&A.=2);
%PUT &B.;
%END;
%MEND; %CYCLE; On the log I find this: 1
0.636805089257504*(1=1)+0.656423671305948*(1=2)
2
0.636805089257504*(2=1)+0.656423671305948*(2=2) I expected it to be 1
0.636805089257504
2
0.656423671305948 What am I missing? Finally, for my actual question, regarding the second block of code, I'm trying to sue the variable B within a Data-Step and it's obvious from some simple computations that B isn't getting the value I expected it to get. In fact, it gets a value that doesn't seem at all related with any of the coefficients used above. I worked around this by defining B withing the Data-Step, but this is seems crass. Can you explain to me why isn't my macro variable B working properly and how can I fix it? Thanks.
... View more