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 (August 2011, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 9 Aug 2011 21:16:09 -0400
Reply-To:     shyamprasad samisetti <shyam.cbz@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         shyamprasad samisetti <shyam.cbz@GMAIL.COM>
Subject:      Re: Create macro variable from one value or all values in a field
Comments: To: dave crimkey <d_crimkey@yahoo.com>
In-Reply-To:  <CAHhThZCtRXrg4aRiL9KjjizrHVy5w2pFkhj22WVpMxmyDOPrxg@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

> You can try calling the below macro. subset macro parameter is to subset > your data per your customer name. keep it missing to summarize whole > dataset. > > %MACRO sum(subset=); > Proc summary nway missing data=testdata; > %if %upcase(&subset) ne %Then %do; > where upcase(customer_name) = "&subset"; > %end; > class salesid invoice_number customer_name year month; > var sales_amount; > output out=summarized_data (drop=_:) sum=; > run; > %MEND SUM; > > Eg: > %SUM(subset=); > %SUM(subset=MICHAEL); > > Thx > Shyam. > > On Tue, Aug 9, 2011 at 8:52 PM, dave crimkey <d_crimkey@yahoo.com> wrote: > >> I'm summarizing some data by 5 or 6 fields. The user would like the >> ability to choose, at the beginning of the program, either one value of, for >> example, a customer name field or all values of the customer name field. So >> my summary looks like this: >> >> Proc summary nway missing data=testdata; >> class salesid invoice_number customer_name year month; >> var sales_amount; >> output out=summarized_data (drop=_:) sum=; >> run; >> >> Customer name could have any number of possible values (it is a text >> field) and the user would like to be able to specify A value (in a macro >> variable) or all values. So I'm doing a let statement: >> >> %let cust_name = ????? >> >> But I'm not sure if or how to accomplish this. >> >> Any help would be appreciated. >> >> Thanks >> > >


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