if Visitn=999, then need to change it to scheduled.
EX: If the previous Visit is 7, and if the next visit is Unschedule then AVISITN=7.1,
if the same vist has more than one unschedule, then seq schould come as 7.1,7.2..
haow can i change
eg; 1
2
3
4
5
999
6
after 5 i want 5.1, 5.2 how can i get plz help....
If you want answers providing code then you need to provide representative sample data (as a fully working SAS data step creating such sample data) and then clearly show the desired result.
I'm going to assume you have more variables in your data set ... at least a patient identifier so you know which visit belongs to which patient.
What should happen if the first visit is 999 for a patient? Well, I will assume you want AVISITN to be 0.1, 0.2, etc.
proc sort data=have;
by patient visitn;
run;
data want;
set have;
by patient;
if first.patient then avisitn=0;
if visit=999 then avisitn + 0.1;
else avisitn = visitn;
run;
********** EDITED:
Upon further reflection, the sort should be by PATIENT only:
proc sort data=have;
by patient;
run;
Otherwise, it put's all the patient's 999 visits at the end, which is the wrong order. If you have a variable that would put the in the proper order, you can use that as well:
proc sort data=have;
by patient date;
run;
Please see the first example code in this article (https://www.mwsug.org/proceedings/2009/stats/MWSUG-2009-D14.pdf).
If you want answers providing code then you need to provide representative sample data (as a fully working SAS data step creating such sample data) and then clearly show the desired result.
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.