/* The %LET commands appear before the DATA step. Note that the character */ /* string "cube" doesn't need quotes */ %let mypower=3; %let powerword=cube; /* The DATA step looks pretty normal */ data a; input x; y=x**&mypower; datalines; 3 5 7 ; run; /* Double quotes are needed for the TITLE statement in order */ /* for SAS to read the character variable*/ Title "Taking the &powerword of each x value"; proc print data=a; run; /* Students should replace the filename in the active LET command */ /* with their own txt file from CE 8 */ /* It would be interesting to make this macro more flexible--e.g., have it pull */ /* out the student names from their text files */ *%let Exercise8=Class_Exercise_8_grego_1_EXER8; *%let Exercise8=EXER8; *%let Exercise8=/STAT 540/EXER8; data a; infile "/home/grego1/STAT 540/&Exercise8..TXT"; *infile "/home/grego1&Exercise8..TXT"; input x1-x10 xbar; run; proc print data=a; /* double quotes around .txt did not work--a single stray double quote was printed */ title "Output file: &Exercise8..txt"; run;