|
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.
|