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 10:51:42 -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:   Better ways to put value into Macro variable during data step?
Content-Type:   text/plain; charset="us-ascii"

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