Thanks a huge. But I have to say my SAS/computer has problem NOW. 1) I run you code, the put line does not show up the value[see below], as seen in your log. 2) run a simple code below, it complains. 3) The code I am running on giganttttic data does not change any. It used to be ok! _______________________________________________________________________ proc sql; select case when horsepower>210 then 1 else 0 end as is_big, "big flag" as flag_note, count(*) as cttot from sashelp.cars group by 1,2; quit;___________________________________________________ 9121 proc sql; 9122 select case when horsepower>210 then 1 else 0 end as is_big, "big flag" as flag_note, count(*) - 22 200 9122! as cttot ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, a missing value, (, *, +, -, BTRIM, CALCULATED, CASE, EXISTS, INPUT, NOT, PUT, SUBSTRING, TRANSLATE, USER, ^, ~. ERROR 200-322: The symbol is not recognized and will be ignored. 9123 from sashelp.cars 9124 group by 1,2; 9125 quit; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE SQL used (Total process time): real time 0.00 seconds cpu time 0.01 seconds ———————————————————————— 9092 options mprint symbolgen; 9093 9094 %macro pctvar(ds, var, note); 9095 proc univariate data=&ds. noprint; 9096 var &var.; 9097 output out=a pctlpre=¬e._p_ pctlpts= 5 to 95 by 5; 9098 run; 9099 9100 data _null_; 9101 set a; 9102 array ¬e._p_ ¬e._p_:; 9103 do over ¬e._p_; 9104 call symputx(vname(¬e._p_), ¬e._p_, 'g'); 9105 end; 9106 run; 9107 9108 proc sql; 9109 drop table a; 9110 quit; 9111 9112 %put "p_5=&&¬e._p_5. p_50=&&¬e._p_50. p_95=&&¬e._p_95."; 9113 %mend; 9114 9115 %pctvar(sashelp.cars, horsepower, hp); MLOGIC(PCTVAR): Beginning execution. MLOGIC(PCTVAR): Parameter DS has value sashelp.cars MLOGIC(PCTVAR): Parameter VAR has value horsepower MLOGIC(PCTVAR): Parameter NOTE has value hp SYMBOLGEN: Macro variable DS resolves to sashelp.cars MPRINT(PCTVAR): proc univariate data=sashelp.cars noprint; SYMBOLGEN: Macro variable VAR resolves to horsepower MPRINT(PCTVAR): var horsepower; SYMBOLGEN: Macro variable NOTE resolves to hp MPRINT(PCTVAR): output out=a pctlpre=hp_p_ pctlpts= 5 to 95 by 5; MPRINT(PCTVAR): run; NOTE: The data set WORK.A has 1 observations and 19 variables. NOTE: PROCEDURE UNIVARIATE used (Total process time): real time 0.02 seconds cpu time 0.01 seconds MPRINT(PCTVAR): data _null_; MPRINT(PCTVAR): set a; SYMBOLGEN: Macro variable NOTE resolves to hp SYMBOLGEN: Macro variable NOTE resolves to hp MPRINT(PCTVAR): array hp_p_ hp_p_:; SYMBOLGEN: Macro variable NOTE resolves to hp MPRINT(PCTVAR): do over hp_p_; SYMBOLGEN: Macro variable NOTE resolves to hp SYMBOLGEN: Macro variable NOTE resolves to hp MPRINT(PCTVAR): call symputx(vname(hp_p_), hp_p_, 'g'); MPRINT(PCTVAR): end; MPRINT(PCTVAR): run; NOTE: There were 1 observations read from the data set WORK.A. NOTE: DATA statement used (Total process time): real time 0.02 seconds cpu time 0.03 seconds MPRINT(PCTVAR): proc sql; MPRINT(PCTVAR): drop table a; NOTE: Table WORK.A has been dropped. MPRINT(PCTVAR): quit; NOTE: PROCEDURE SQL used (Total process time): real time 0.00 seconds cpu time 0.01 seconds MLOGIC(PCTVAR): %PUT "p_5=&&¬e._p_5. p_50=&&¬e._p_50. p_95=&&¬e._p_95." SYMBOLGEN: Macro variable NOTE resolves to hp SYMBOLGEN: Macro variable NOTE resolves to hp SYMBOLGEN: Macro variable NOTE resolves to hp "p_5=&&hp_p_5. p_50=&&hp_p_50. p_95=&&hp_p_95."
... View more