DATA Step, Macro, Functions and more

macro variable not resolved

Reply
New Contributor
Posts: 3

macro variable not resolved

Hi, I have the following code. Variable jobnum won't get resolved to 1111 when invoking the macro. Please advise.

 

%macro testttt (jobnum);

options remote=cpsc01 comamid=tcp;
/* ---------------------------------------------------------------- */
filename rlink "C:\Users\dylan.liu\Documents\psc01.txt";

signon cpsc01;

rsubmit; /*Tells SAS to submit to UNIX, as opposed to PC */
libname ndw oracle user=B1187361_OTSUKA_CUSTOM password=B1187361 path=paa schema=B1187361_OTSUKA_CUSTOM;
endrsubmit;
rsubmit;
options obs=MAX;

data _null_;
%let _EFIERR_ = 0; /* set the ERROR detection macro variable */
%let _EFIREC_ = 0; /* clear export record count macro variable */
file "/fs501.1/SAS/FINAL_RPT_1803_TEST&jobnum..csv" delimiter=',' DSD DROPOVER lrecl=32767;
if _n_ = 1 then /* write column names or labels */
do;
put
"IMSID"
','
"Rx Type"
','
"Payer Plan ID"
','
"Product Group"
','
"Source of Business"
','
"Diagnosis Group"
','
"Age Group"
','
"Payment Type"
','
"TRX24"
','
"TRX23"
','
"TRX22"
','
"TRX21"
','
"TRX20"
','
"TRX19"
','
"TRX18"
','
"TRX17"
','
"TRX16"
','
"TRX15"
','
"TRX14"
','
"TRX13"
','
"TRX12"
','
"TRX11"
','
"TRX10"
','
"TRX9"
','
"TRX8"
','
"TRX7"
','
"TRX6"
','
"TRX5"
','
"TRX4"
','
"TRX3"
','
"TRX2"
','
"TRX1"
','
"NRX24"
','
"NRX23"
','
"NRX22"
','
"NRX21"
','
"NRX20"
','
"NRX19"
','
"NRX18"
','
"NRX17"
','
"NRX16"
','
"NRX15"
','
"NRX14"
','
"NRX13"
','
"NRX12"
','
"NRX11"
','
"NRX10"
','
"NRX9"
','
"NRX8"
','
"NRX7"
','
"NRX6"
','
"NRX5"
','
"NRX4"
','
"NRX3"
','
"NRX2"
','
"NRX1"
;
end;
set NDW.FINAL_RPT_1803_unknown end=EFIEOD;
format IMS_RXER_ID $7.;
format CHNL_CD $1. ;
format PAYER_PLAN_ID $10.;
format PRODUCT_GROUP $21.;
format SOB $13.;
format DX_INDICATION $17.;
format AGE_GROUP $7.;
format PAY_TYP_DESC $15.;
format TRX24 best12.;
format TRX23 best12.;
format TRX22 best12. ;
format TRX21 best12. ;
format TRX20 best12. ;
format TRX19 best12. ;
format TRX18 best12. ;
format TRX17 best12. ;
format TRX16 best12. ;
format TRX15 best12. ;
format TRX14 best12. ;
format TRX13 best12. ;
format TRX12 best12. ;
format TRX11 best12. ;
format TRX10 best12. ;
format TRX9 best12. ;
format TRX8 best12. ;
format TRX7 best12. ;
format TRX6 best12. ;
format TRX5 best12. ;
format TRX4 best12. ;
format TRX3 best12. ;
format TRX2 best12. ;
format TRX1 best12. ;
format NRX24 best12. ;
format NRX23 best12. ;
format NRX22 best12. ;
format NRX21 best12. ;
format NRX20 best12. ;
format NRX19 best12. ;
format NRX18 best12. ;
format NRX17 best12. ;
format NRX16 best12. ;
format NRX15 best12. ;
format NRX14 best12. ;
format NRX13 best12. ;
format NRX12 best12. ;
format NRX11 best12. ;
format NRX10 best12. ;
format NRX9 best12. ;
format NRX8 best12. ;
format NRX7 best12. ;
format NRX6 best12. ;
format NRX5 best12. ;
format NRX4 best12. ;
format NRX3 best12. ;
format NRX2 best12. ;
format NRX1 best12. ;
do;
EFIOUT + 1;
PUT IMS_RXER_ID $ @;
put CHNL_CD $ @;
put PAYER_PLAN_ID $ @;
put PRODUCT_GROUP $ @;
put SOB $ @;
put DX_INDICATION $ @;
put AGE_GROUP $ @;
put PAY_TYP_DESC $ @;
put TRX24 @;
put TRX23 @;
put TRX22 @;
put TRX21 @;
put TRX20 @;
put TRX19 @;
put TRX18 @;
put TRX17 @;
put TRX16 @;
put TRX15 @;
put TRX14 @;
put TRX13 @;
put TRX12 @;
put TRX11 @;
put TRX10 @;
put TRX9 @;
put TRX8 @;
put TRX7 @;
put TRX6 @;
put TRX5 @;
put TRX4 @;
put TRX3 @;
put TRX2 @;
put TRX1 @;
put NRX24 @;
put NRX23 @;
put NRX22 @;
put NRX21 @;
put NRX20 @;
put NRX19 @;
put NRX18 @;
put NRX17 @;
put NRX16 @;
put NRX15 @;
put NRX14 @;
put NRX13 @;
put NRX12 @;
put NRX11 @;
put NRX10 @;
put NRX9 @;
put NRX8 @;
put NRX7 @;
put NRX6 @;
put NRX5 @;
put NRX4 @;
put NRX3 @;
put NRX2 @;
put NRX1 ;
;
end;
if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */
if EFIEOD then call symputx('_EFIREC_',EFIOUT);
run;
%mend testttt;

%testttt(1111)

Trusted Advisor
Posts: 1,387

Re: macro variable not resolved

Posted in reply to laeotropic

Inside the macro, after the signon but before referenced to macrovar JOBNUM, you have to tell your sas/connect client to upload the macrovar to the host:

 

  %syslput jobnum=&jobnum;

 

JOBNUM is a local macrovar in your client machine, but will be a global macrovar on the host.

Ask a Question
Discussion stats
  • 1 reply
  • 110 views
  • 0 likes
  • 2 in conversation