/*I have 61 datasets, numbered A1 thru A94. All 61 datasets have a variable FourDig, with values such as 3112, 4561. I need to substring the first 2 digits and save them into a new variable TwoDig in each of the datasets (in this case, 31 and 45).
I tried following code. I got a new var TwoDig ok, but the variable is empty. I also get a new empty variable (I believe the first two digits of FourDig).
A SAS novice, I am looking forward to help from you great people! */
%macro Four2two;
%do i = 1 %to 94;
data A&i;
set A&i;
TwoDig = substr(FourDig,1,2);
run;
%end;
%mend Four2Two;
... View more