I can't get the string from memory into my dataset. Instead of going into my Variable, it's coming as a variable by itself! Please help!! Code which runs by itself data WORK.TEMP3; format CAT $10. AVG_BY_CAT DOLLAR2. DATE DDMMYY10. ; length CAT $10.; INFILE DATALINES DLM=',' DSD; input CAT: $10. AVG_BY_CAT: DOLLAR2. DATE DDMMYY10. ; DATALINES; DOGS,1,01/01/2001 CATS,2,02/01/2001 HORSE,3,03/01/2001 FISH,4,04/01/2001 ; run; %macro JT_MACRO(REF); %global COUNTER; %global thisDOLLAR; %global thisDATE; %global thisPET; %let dsid=%sysfunc(open(TEMP3,i)); %let nobs=%sysfunc(attrn(&dsid, nobs)); %do i=1 %to &nobs; %let rc=%sysfunc(fetch(&dsid)); %let COUNTER=%sysfunc(GetVarC(&dsid, %sysfunc(VarNum(&dsid, CAT)))); %if &COUNTER = &REF %then %do; %let thisDOLLAR=%sysfunc(GetVarN(&dsid, %sysfunc(VarNum(&dsid, AVG_BY_CAT)))); %let thisDATE=%sysfunc(GetVarN(&dsid, %sysfunc(VarNum(&dsid, DATE)))); %let thisPET=%sysfunc(GetVarC(&dsid, %sysfunc(VarNum(&dsid, CAT)))); %end; %end; %let rc = %sysfunc(close(&dsid)); %mend JT_MACRO; %JT_MACRO(FISH); %put --> &thisDOLLAR; %put --> &thisDATE; %put --> &thisPET; DATA TEMP4; SET TEMP3; format MEM_DOLLAR DOLLAR9. MEM_DATE DDMMYY10. MEM_STR $15.; length MEM_STR $15.; MEM_DOLLAR = &thisDOLLAR; MEM_DATE = &thisDATE; MEM_STR = &thisPET; RUN;
... View more