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 (March 2011, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 2 Mar 2011 15:03:20 -0500
Reply-To:     "Bian, Haikuo" <HBian@NW7.ESRD.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Bian, Haikuo" <HBian@NW7.ESRD.NET>
Subject:      Re: Better ways to put value into Macro variable during data
              step_side question added
Comments: To: "Data _null_;" <iebupdte@GMAIL.COM>
In-Reply-To:  <AANLkTimGd9Td75A-tc2KNht_CdDbG-HOkO4uA=au9vnn@mail.gmail.com>
Content-Type: text/plain; charset="us-ascii"

A side question:

After I have converted files, the obs sequences in some target oracle tables have been altered. It is like Oracle resorted the data from SAS table during the course of converting. Is there anything I can do to prevent this from happening?

Thanks, Haikuo

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Data _null_; Sent: Wednesday, March 02, 2011 1:50 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Better ways to put value into Macro variable during data step?

Not all functions can be called with SYSFUNC. PUT and INPUT are two.

On Wed, Mar 2, 2011 at 11:47 AM, Bian, Haikuo <HBian@flqio.sdps.org> wrote: > It worked like charm! Thank you , data_null_, for letting me aware of 'putc' and 'putn". I actually have tried "%sysfunc" with "PUT", but that didn't work out, don't know why. > > Thanks again, > Haikuo > > -----Original Message----- > From: Data _null_; [mailto:iebupdte@gmail.com] > Sent: Wednesday, March 02, 2011 11:31 AM > To: Bian, Haikuo > Cc: SAS-L@listserv.uga.edu > Subject: Re: Better ways to put value into Macro variable during data step? > > CALL SYMPUTX ("LE",PUT(&LEVEL, $LV.)); > > What is the value of &LEVEL. > > Perhaps... > %let LE = %sysfunc(putC(&level,$LV)); > > > On Wed, Mar 2, 2011 at 10:25 AM, Bian, Haikuo <HBian@flqio.sdps.org> wrote: >> I think I have not clarified my concerns: >> >> Do I have to involve "call symput" and data step to make it work? Will a simple "%let" do the same trick? >> >> Thanks, >> Haikuo >> >> -----Original Message----- >> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Bian, Haikuo >> Sent: Wednesday, March 02, 2011 10:52 AM >> To: SAS-L@LISTSERV.UGA.EDU >> Subject: Better ways to put value into Macro variable during data step? >> >> Dear List, >> >> The following code works for my purpose. I was trying to convert SAS tables into Oracle tables, since tables are named following certain rules, I was able to use loops to reduce my labor. I have applied two "data _null_' steps to insert values into the Macro variables I need in downstream data step. I am new to Macro in general, so My gut told me there must be better practices out there. Please advise. >> >> libname upload oracle user='xxx' password='xxx' path='xxx'; >> >> %macro convert; >> %DO TYPE=1 %TO 3; >> DATA _NULL_;*first one, to put value into macro variable TP; >> CALL SYMPUTX ("TP",PUT(&TYPE,$TP.)); >> RUN; >> >> %do level=1 %to 4; >> DATA _NULL_; *second one, to put values to variable LE and LE_ID; >> CALL SYMPUTX ("LE",PUT(&LEVEL, $LV.)); >> CALL SYMPUTX ("LE_ID", PUT (&LEVEL, $LV_ID.)); >> RUN; >> data upload.CPM_&TP._&LE._&dt. ; >> informat cpm_&TP._NATIONAL_id >> &LE_ID >> month_year_id >> cpm_domain >> cpm_number >> percentage >> numerator >> denominator ; >> set cpm.cpm_&TP._&level._&dt2.; >> keep cpm_&TP._NATIONAL_id >> &LE_ID >> month_year_id >> cpm_domain >> cpm_number >> percentage >> numerator >> denominator ; >> run; >> %END; >> %end; >> %mend; >> >> %convert; >> >> >> >> >> >> >> Thanks! >> >> Haikuo >> >> >> >> ----------------------------------------- >> Email messages cannot be guaranteed to be secure or error-free as >> transmitted information can be intercepted, corrupted, lost, >> destroyed, arrive late or incomplete, or contain viruses. The >> Centers for Medicare & Medicaid Services therefore does not accept >> liability for any error or omissions in the contents of this >> message, which arise as a result of email transmission. >> >> CONFIDENTIALITY NOTICE: This communication, including any >> attachments, may contain confidential information and is intended >> only for the individual or entity to which it is addressed. Any >> review, dissemination, or copying of this communication by anyone >> other than the intended recipient is strictly prohibited. If you >> are not the intended recipient, please contact the sender by reply >> email and delete and destroy all copies of the original message. >> >


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