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 (May 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 30 May 2008 16:04:37 -0500
Reply-To:     "data _null_," <datanull@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "data _null_," <datanull@GMAIL.COM>
Subject:      Re: Counting total and create text string
Comments: To: KJ <krutic@gmail.com>
In-Reply-To:  <99457792-18c6-448c-8d0d-9a78820a814d@34g2000hsf.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1

Would splitting the NAME into the root and number parts be helpful. I don't really understand what you want to accomplish.

data work.mayHave; input root:$8. @@; do i = 1 to floor(ranuni(1234)*1e2); name = catx('_',root,i); output; end; keep name; cards; OFFER SVA LVA ;;;; run; data work.mayNeed; set work.MayHave; length root $10; root = scan(name,1,'_'); n = input(scan(name,2,'_'),f8.); run; proc print; run;

On 5/30/08, KJ <krutic@gmail.com> wrote: > Hello, > > I need to sort offers, SVA and LTA based on sort keys that I create. > Currently I am hardcoding these sort keys as shown below: > > ********************* > data one; > set two; > > if name = 'OFFER_1' then srtkey = 4; > if name = 'OFFER_2' then srtkey = 5; > . > . > . > > if name = 'SVA_1' then srtkey = 40; > if name = 'SVA_2' then srtkey = 41; > . > . > . > > if name = 'LVA_1' then srtkey = 80; > if name = 'LVA_2' then srtkey = 81; > . > . > . > > if srtkey = . then srtkey = 999; > > proc sort data= one; by sortkey;run; > > **************** > The number goes as high as 40 currently but likely to go higher. Is > there a way to count the total number of these offers (which will be > the same as the number of sva and lva) and put it in a macro variable > which prints out the text string > if name = xxxx_yy' then srtkey = xx; ? > > I have a counter that counts the total number of offers and it is > stored in &total. How can I use that for this? > > So I'm thinking something along the lines of retaining the previous > number as long as its less than &total and adding one to that number > to get the next till they reach &total. Basically a loop that gives me > the above strings without having to type them individually over 200 > times! > > Thank you, > KJ >


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