LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 18 Sep 2006 14:49:40 -0500
Reply-To:     SAS_learner <proccontents@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         SAS_learner <proccontents@GMAIL.COM>
Subject:      Is there any difference in way macro created ??
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

hello guys , I am generating a macro like this to used for caliculating percentages like this

proc freq data=V_AE noprint; tables TREAT_R / missing out=freq0(keep=TREAT_R COUNT); run;

proc sql noprint; create table total as select sum(count) as total from freq0 where treat_r ^= ' ' ;

quit; data _null_; set total; call symput("tot1",put(total,3.)); call symput ("mftot1","N="|| trim(left(put(total,3.)))!!")"); run;

to be used as total like this

proc sql noprint; create table V_FINAL_cu1 as select a.*,a.mi_count/input("&tot1",3.) * 100 as perct , a.mo_count/input("&tot1",3.) * 100 as perct1 ,a.se_count/input("&tot1",3.) * 100 as perct2 from V_FINAL_cu as a ; quit;

everything is fine when I am doing this way (above ) but when I trying to do same thing avoiding call symput (below) the value of &tot is getting resolved i.e.

proc sql noprint; select sum(count) into : tot1 from freq0 where treat_r ^= ' ' ; %put &tot1; quit;

proc sql noprint; create table V_FINAL_cu1 as select a.*,a.mi_count/input("&tot1",3.) * 100 as perct , a.mo_count/input("&tot1",3.) * 100 as perct1 ,a.se_count/input("&tot1",3.) * 100 as perct2 from V_FINAL_cu as a ; quit;

this way &tot1 is not resolving why ?? and one is there a way I can create two macro variable using proc sql similar to what I am doing using call symput ??

thanks for your time and advice.


Back to: Top of message | Previous page | Main SAS-L page