Hi, It will be great if somebody could help me out here. I am trying to create this new variable from my existing dataset. In my current dataset I have variables section1 and section2 and other variables var1_1, var_3, var1_4, etc based on the value of the variables section1 and section2. I am trying to create 2 new variables that contain the value of variables var_i, var_j where "i" and "j" are the values of variables section1 and section2. I don't fully understand how symput works but have the following working code. Somehow hist1 and hist2 only show the value of the corresponding var_k for the very last record in the dataset. And also, how do I convert the macro variable to a variable in the dataset "sections_mod"? data sections_mod; set sections end=eof; if eof then do; call symput("num1", trim(compress(Section1))); call symput('Hist1', VAR_&num1); hist1= &Hist1; call symput("num2", trim(compress(Section2))); call symput('Hist2', VAR_&num2); hist2= &Hist2; end ; run; %put _user_; Any thoughts? Thanks, Aarthi
... View more