Hi,
I am writting a program and want to assign the values of the existing variable to a new variable with some modification, but have a problem with it. the new variable VISNUMEN has the missing value. Any help is greatly appreciated. the coding is as the following:
if VISITNUM=13 and strip(upcase(DSTERM))='PROTCOL COMPLETED' then VISNUMEN=12; else if VISITNUM=12 and strip(upcase(DSTERM))='PROTCOL COMPLETED' then VISNUMEN=VISITNUM;
Thanks!
Fix these two issues and you'll solve your problem:
It has all missing values or some missing values? Are you sure all conditions are being capture by your logic?
The easiest way to check something like this is to use a PROC FREQ with the new and old values.
proc freq data=have;
where strip(upcase(dsterm)) = 'PROTOCOL COMPLETED' ;
table visitnum*visnumen;
run;
Thanks Reeza for the response. Yes, it is all missing values.
Here the coding purpose is to change the vaule of '13' for VISITNUM to the vaule of '12' of VISNUMEN. it seems that this did not work
1. What does your log say?
2. What's the type and format of visitnum
Fix these two issues and you'll solve your problem:
you may need to give a else statement. If you can do not give else statement, then you will get null if scenarious you have mentioned does not cover all the records. you should probably do else varnum = somevalue
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.