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 (October 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 26 Oct 2005 08:14:29 -0700
Reply-To:     "Terjeson, Mark (IM&R)" <Mterjeson@RUSSELL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Terjeson, Mark (IM&R)" <Mterjeson@RUSSELL.COM>
Subject:      The SUM function
Comments: To: jashby2@GMAIL.COM
Content-Type: text/plain; charset="us-ascii"

Whups again, guess I need some coffee. Thanks Chang, I had it on my mind and forgot to go back and put in the dataset criteria. This does nicely now. Third time is the charm.

* build same suffix arglist ; %macro sumsfx(ds,suffix); %global samesfx; %* handle with or without libref ; %if %index(&ds,.) eq 0 %then %do; %let _lib=work; %let _ds=&ds; %end; %else %do; %let _lib=%scan(&ds,1,.); %let _ds=%scan(&ds,2,.); %end; proc sql noprint; select distinct name into :samesfx separated by ',' from sashelp.vcolumn where upcase(libname) eq upcase("&_lib") and upcase(memname) eq upcase("&_ds") and name like "%nrstr(%%)&suffix."; quit; %put samesfx var list is >&samesfx<; %mend;

data sample; acount=1; bcount=2; ccount=3; dcount=4; dbbbbb=4; run;

%sumsfx(sample,count); * create same suffix variable list ; data result; set sample; abcdsum = sum(&samesfx); run;

Mark Terjeson Senior Programmer Analyst, IM&R Russell Investment Group 253-439-2367

Russell Global Leaders in Multi-Manager Investing

> The information contained in this message is intended only for the use > of the recipient named above. This message may contain confidential > or undisclosed information. If the reader of this message is not the > intended recipient or an agent responsible for delivering to the > intended recipient, you are hereby notified that you have received > this message in error, and that any review, dissemination, > distribution or copying of it is strictly prohibited. If you have > received this message in error, please notify us by telephone > immediately at 253-439-2367. Thank you for your cooperation. > > > >


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