Hi All even thogh memid is having name as sasadministartors iam getting incorrect value as vv instead of SAS Administrators if i use nested if not=
syntax,please help
data t;
set work.groupmempersons_info(where=(memid='xxxxxxxxx'));
length desc $255;
call missing (desc);
if memName = "sasadm" or memname = "sasevs" or memname = "sastrust" then put "Account is sasadm, sasevs or sastrust, skipping.";
else
if Name= :'SASAdministrators' or Name= :'DI Developers' then desc='SAS Administrator';
if Name not= :'XXX' and Name not=:'YYY' then desc='vv';
;
rc=metadata_setattr("omsobj:person\"||memid,"Desc",desc);
put rc=;
run;
This statement:
if Name not= :'XXX' and Name not=:'YYY' then desc='vv';
Is always executed regardless of what happened with the earlier if.
I think you want:
data t;
set work.groupmempersons_info(where=(memid='xxxxxxxxx'));
length desc $255;
call missing (desc);
if memName = "sasadm" or memname = "sasevs" or memname = "sastrust" then put "Account is sasadm, sasevs or sastrust, skipping.";
else /* <= this else only effects the next statement*/
if Name= :'SASAdministrators' or Name= :'DI Developers' then desc='SAS Administrator';
ELSE if Name not= :'XXX' and Name not=:'YYY' then desc='vv';
;
rc=metadata_setattr("omsobj:person\"||memid,"Desc",desc);
put rc=;
run;
This statement:
if Name not= :'XXX' and Name not=:'YYY' then desc='vv';
Is always executed regardless of what happened with the earlier if.
I think you want:
data t;
set work.groupmempersons_info(where=(memid='xxxxxxxxx'));
length desc $255;
call missing (desc);
if memName = "sasadm" or memname = "sasevs" or memname = "sastrust" then put "Account is sasadm, sasevs or sastrust, skipping.";
else /* <= this else only effects the next statement*/
if Name= :'SASAdministrators' or Name= :'DI Developers' then desc='SAS Administrator';
ELSE if Name not= :'XXX' and Name not=:'YYY' then desc='vv';
;
rc=metadata_setattr("omsobj:person\"||memid,"Desc",desc);
put rc=;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.