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 (February 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 23 Feb 2008 01:09:16 +0100
Reply-To:     Stefan Pohl <stefan.pohl@ISH.DE>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Stefan Pohl <stefan.pohl@ISH.DE>
Subject:      AW: AW: problem with macro variable
Comments: cc: toby dunn <tobydunn@HOTMAIL.COM>
In-Reply-To:  <BAY123-W22EEA058647F482A4E137CDE1C0@phx.gbl>
Content-Type: text/plain; charset="us-ascii"

Dear sas.group,

ff digits=3 this way does not work. Is there another way?

Best wishes, Stefan.

> %MACRO abc; > ... DATA digits_&data (DROP = maxid); SET idmax_&data (obs=1 keep=maxid); digits = int(log10(maxid))+1; RUN;

DATA _null_; SET digits_&data; call symputx("digits",Length(Strip(digits))); *stop; RUN;

> DATA &data.1 ; > SET &data; > idChar=PUT(&id,Best&Digits..); > RUN; > > %MEND abc; > > > Toby Dunn > > "Don't bail. The best gold is at the bottom of barrels of crap." > Randy Pausch > > "Be prepared. Luck is where preparation meets opportunity." > Randy Pausch > > > > Date: Thu, 21 Feb 2008 20:28:15 +0100 > > From: stefan.pohl@ISH.DE > > Subject: AW: problem with macro variable > > To: SAS-L@LISTSERV.UGA.EDU > > > > Hi sas-group, > > > > double dots do not work. Is there another way? > > > > Best regards, Stefan. > > > > > > _____ > > > > Von: Yu Zhang [mailto:zhangyu05@gmail.com] > > Gesendet: Donnerstag, 21. Februar 2008 19:57 > > An: Stefan Pohl > > Cc: SAS-L@listserv.uga.edu > > Betreff: Re: problem with macro variable > > > > > > try digit.. > > > > two dots instead of one dot. > > > > Yu > > > > > > On Thu, Feb 21, 2008 at 12:49 PM, Stefan Pohl wrote: > > > > > > Hi sas-group, > > > > within a macro I want to transform a numerical id in a character id. > > Normally you write idChar=PUT(id,4.); > > if your biggest id is for example 1208. > > > > I want to generalize the 4. information as it depends on > your data set. > > > > I have done this > > > > %MACRO abc; > > > > ... > > > > PROC MEANS DATA=&data; > > VAR &id; > > OUTPUT OUT = idmax_&data max=maxid; > > RUN; > > > > DATA digits_&data (DROP = maxid); > > SET idmax_&data (obs=1 keep=maxid); > > digits = int(log10(maxid))+1; > > RUN; > > > > DATA _null_; > > SET digits_&data; > > call symput("digits",left(put(digits,best12.))); > > stop; > > RUN; > > > > DATA &data.1 (DROP=&id RENAME=(idChar=&id)); SET &data; > LENGTH idChar > > $100.; > > > > idChar=PUT(&id,&digits.); *<-- this does nor work! Problem with the > > DOT !!!; RUN; > > > > %MEND abc; > > > > Best regards, Stefan. > > _________________________________________________________________ > Helping your favorite cause is as easy as instant messaging. > You IM, we give. > http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join > > __________ NOD32 2894 (20080221) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.eset.com > >


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