Hi everyone, my intention to export Sasdata set to Excel is to concatenate each record and evaluate the character expression, (which I know well how to do in Excel). The bigger picture of my interest is to list out all possibilities of using the number '1', '3' ,4' '6' and operators '+', '-', '*' '/' and with "(" and ")" considered. Here is my code and the dataset=FINAL_Last1 (where the variable 'Summing' contains 200000+ records) is where I get stuck to use Excel. How can I tell SAS to evaluate the string expression resided in variable 'Summing'? I found out I can use Macro, but would like to see your answers. By the way, thank you Reeza for the tagset solution. That is really new to me. The code may not be efficient to do what it intends to, I am learning and playing around with SAS. Welcome any inputs. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ OPTIONS OBS=MAX ; OPTIONS FIRSTOBS=1 ; data New_X1 ; INPUT X1 $1; DATALINES; + - * / ; RUN; data New_X2 ; INPUT X2 $1; DATALINES; + - * / ; RUN; data New_X3 ; INPUT X3 $1; DATALINES; + - * / ; RUN; PROC SQL; CREATE TABLE hope AS SELECT * FROM New_X1, New_X2 ,New_X3; RUN; data New_Y (KEEP=y1s y2s y3s y4s); array y[4] $1 ('1' '3' '4' '6'); n2=fact(4); DO i=1 to n2; permut_OrderImportant2=allperm(i, of y ); put permut_OrderImportant2 +2 y1-y4; y1s=y[1]; y2s=y[2]; y3s=y[3]; y4s=y[4];output; END; RUN; data New_Z (KEEP=Z1s Z2s Z3s Z4s Z5s Z6s); array z[6] $1 ('(' ')' '' '' '' ''); n3=fact(6); DO i=1 to n3; permut_OrderImportant2=allperm(i, of z ); put permut_OrderImportant2 +2 z1-z4; Z1s=z[1]; Z2s=z[2]; Z3s=z[3]; Z4s=z[4]; Z5s=z[5]; Z6s=z[6];output; END; RUN; PROC SQL; CREATE TABLE FINAL AS SELECT Z1s,y1s,X1,Z2s,y2s,Z3s,X2,Z4s,y3s,Z5s,X3,y4s,Z6s FROM hope, New_Y, New_Z; RUN; PROC PRINT DATA=FINAL; RUN; DATA FINAL_Last; SET FINAL; IF (z1s eq ")") THEN DELETE; IF (z2s eq ")") THEN DELETE; IF (z3s eq "(") THEN DELETE; IF (z4s eq ")") THEN DELETE; IF (z5s eq "(") THEN DELETE; IF (z6s eq "(") THEN DELETE; IF (z1s eq "" and z2s=")" ) THEN DELETE; IF (z1s eq "" and z3s=")" ) THEN DELETE; IF (z4s eq "(" and z5s=")" ) THEN DELETE; RUN; DATA FINAL_Last1 (KEEP=Summing); SET FINAL_Last; Summing= Z1s||y1s||X1||Z2s||y2s||Z3s||X2||Z4s||y3s||Z5s||X3||y4s||Z6s; RUN; PROC CONTENTS DATA=FINAL_Last1; RUN;
... View more