BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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.....
1 REPLY 1
RichardH_sas
SAS Employee
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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 855 views
  • 0 likes
  • 2 in conversation