Desktop productivity for business analysts and programmers

problem related to use of macro in base sas 9.1

Reply
N/A
Posts: 0

problem related to use of macro in base sas 9.1

i have one sas data set . i have to check the value of some certain column in this data set.wheather ther are having missing value or not.
mcolumn : have list of column like col1,col2,col3

data _NULL_;
set lib.ABC;
if upcase(trim(symget('mcolumn'))) = "NA"
then do;
putlog "THEN MODULE";
call symputx('MandRet','1');
stop;
end;
else do;
putlog "not null";
s = countc(trim(symget('mcolumn')),',')+1;
n=1;
do while(n<=s);
put n=;
p=trim(scan(symget('mcolumn'),n,','));
PUT P=;
call symputx('ColValue',p);
IF missing(resolve(P)) THEN DO;
put P=;
PUTLOG "TRUE";
STOP;
END;
n=n+1;
end;
end;
run;
%mend Mandatory_column_check;
%Mandatory_column_check(AmdBLCMExtInitCsmAccount)

in the above program in do while loop i create one macro variable colvalue .it is containg name of column to be checked. in the next step i have to check column's value .....

but there is a rules that if create macro in data step then you can't use that macro in same data step......


i am completly in base sas 9.1 ...i don't know mush about that...and most of the time i get confusion abt macro concept....i am not able to understand how sas program works....please suggets me any book so that i can clear my basic concept.....
SAS Employee
Posts: 149

Re: problem related to use of macro in base sas 9.1

Hi Arvind,

Try reposting -- It looks like all your text didn't show up. Off the top of my head, I would do something like:

array vars[3] col1-col3;
array misscounts[3];
do i=1 to dim(vars);
if vars=. then misscounts+1;
end;

The variables misscounts1-misscounts3 will contain the number of missing values in each of col1-col3. Then you'd just need use that info to figure out how it relates to col1-col3.
Ask a Question
Discussion stats
  • 1 reply
  • 80 views
  • 0 likes
  • 2 in conversation