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
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.
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.