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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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