BookmarkSubscribeRSS Feed
Ken_nuga
Fluorite | Level 6

Please, I need help ASAP.

I have tried this using SAS 9.4 but the blank spaces remain blank and only the formats changed. Thanks.

 

 

 

DATA FACNAME_MERGED;
set work.old_data;
run;
*/ /
/ To assign serial numbers to observations in a data set /
/ /;
DATA FACNAME_MERGED; SET FACNAME_MERGED; SN = _N_; RUN;


*/ TO REPLACE SEX RegLne_ArtStart Reg_ArtStart Curr_RegLine Curr_ART_Reg WITH CDC ACCEPTABLE FORMATS /;

PROC FORMAT;
value $SEX
Male = 'Male' Female = 'Female';

value $RegimenLine_start
"Adult.1st.line" = "Adult.1st.Line" "Adult.2nd.line" = "Adult.2nd.Line" "Peds.1st.line" = "Peds.1st.Line"
"Peds.2nd.line" = "Peds.2nd.Line" "Adult.3rd.line" = "Adult.3rd.Line" "Peds.3rd.line" = "Peds.3rd.Line" ;

value $RegimenLine_Current
"Adult.1st.line" = "Adult.1st.Line" "Adult.2nd.line" = "Adult.2nd.Line" "Peds.1st.line" = "Peds.1st.Line"
"Peds.2nd.line" = "Peds.2nd.Line" "1st Line" = "Peds.1st.Line" "2nd Line" = "Peds.2nd.Line"
"Adult.3rd.line" = "Adult.3rd.Line" "Peds.3rd.line" = "Peds.3rd.Line" ;

value $Regimen_start
"ZDV/3TC/NVP"="AZT-3TC-NVP" "AZT/3TC/NVP"="AZT-3TC-NVP" "NVP only"="AZT-3TC-NVP" "ZDV only"="AZT-3TC-NVP"
"ZDV/3TC"="AZT-3TC-NVP" "3TC/3TC/NVP"="AZT-3TC-NVP" "3TC/ZDV/NVP"="AZT-3TC-NVP" "AZT/3TC/EFV"="AZT-3TC-EFV"
"ZDV/3TC/EFV"="AZT-3TC-EFV" "3TC/3TC/EFV"="AZT-3TC-EFV" "3TC/ZDV/EFV"="AZT-3TC-EFV" "D4T/3TC/NVP"="D4T-3TC-NVP"
"D4T/3TC/EFV"="D4T-3TC-EFV" "TDF/3TC/NVP"="TDF-3TC-NVP" "TDF/3TC"="TDF-3TC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C/3TC/DTG"="ABC-3TC-DTG" "ABC/3TC/NVP"="ABC-3TC-NVP" "ABC/3TC/EFV"="ABC-3TC-EFV"
"ABC/3TC/AZT"="ABC-3TC-AZT" "ABC/FTC/LPVr"="ABC-3TC-LPV/r" "ABC/3TC/LPVr"="ABC-3TC-LPV/r"
"AZT/3TC/LPV/r"="AZT-3TC-LPV/r" "ABC/DDI/LPVr"="ABC-DDI-LPV/r" "DDI/3TC/NVP"="DDI-3TC-NVP"
"ABC/3TC/DDI"="ABC-3TC-DDI" "TDF/3TC/RAL"="TDF-3TC-RAL" "d4T/3TC/LPVr"="D4T-3TC-LPV/r"
"AZT/3TC/RAL"="AZT-3TC-RAL" "DTG+2NRTIs"="DTG + 2 NRTIs" "DRVr+2NRTIs"="DRVr + 2 NRTIs";
run;

DATA SASUSER.FACNAME; Set FACNAME_MERGED;
format Sex $SEX. RegLne_ArtStart $RegimenLine_start. Curr_RegLine $RegimenLine_Current.
Reg_ArtStart $Regimen_start. Curr_ART_Reg $Regimen_Current.;
run;


DATA FACNAME_MERGED; set SASUSER.FACNAME;
IF (Age_ArtStaMnts_5_ ^=. OR Age_ArtStart_Yrs <=14) & /* peads 1st line drug class*/ (Reg_ArtStart = "AZT-3TC-NVP" 
| Reg_ArtStart = "AZT-3TC-EFV" | Reg_ArtStart = "D4T-3TC-NVP" | Reg_ArtStart = "D4T-3TC-EFV" 
| Reg_ArtStart = "ABC-3TC-NVP" | Reg_ArtStart = "ABC-3TC-EFV" | Reg_ArtStart = "ABC-3TC-AZT" 
| Reg_ArtStart = "TDF-3TC-EFV" | Reg_ArtStart = "TDF-3TC-DTG" | Reg_ArtStart = "TDF-3TC-EFV400" 
| Reg_ArtStart = "ABC-3TC-DTG") THEN RegLne_ArtStart = "Peds.1st.Line"; ELSE IF

(Age_ArtStaMnts_5_ ^=. OR Age_ArtStart_Yrs <=14) & /* peads 2nd line drug class*/ (Reg_ArtStart = "ABC-DDI-LPV/r" 
| Reg_ArtStart = "ABC-3TC-LPV/r" | Reg_ArtStart = "AZT-3TC-LPV/r" | Reg_ArtStart = "D4T-3TC-LPV/r" 
| Reg_ArtStart = "DDI-3TC-NVP" | Reg_ArtStart = "ABC-3TC-DDI" | Reg_ArtStart = "TDF-3TC-ATV/r" 
| Reg_ArtStart = "TDF-3TC-RAL" | Reg_ArtStart = "AZT-3TC-RAL") THEN RegLne_ArtStart = "Peds.2nd.Line"; ELSE IF

(Age_ArtStaMnts_5_ =. OR Age_ArtStart_Yrs >14) & /* adult 1st line drug class*/ (Reg_ArtStart = "AZT-3TC-NVP" 
| Reg_ArtStart = "AZT-3TC-EFV" | Reg_ArtStart = "D4T-3TC-NVP" | Reg_ArtStart = "D4T-3TC-EFV" 
| Reg_ArtStart = "TDF-3TC-NVP" | Reg_ArtStart = "TDF-3TC-EFV" | Reg_ArtStart = "TDF-FTC-NVP" 
| Reg_ArtStart = "TDF-FTC-EFV" | Reg_ArtStart = "AZT-3TC-ABC" | Reg_ArtStart = "AZT-3TC-TDF")
THEN RegLne_ArtStart = "Adult.1st.Line"; ELSE IF

(Age_ArtStaMnts_5_ =. OR Age_ArtStart_Yrs >14) & /* adult 2nd line drug class*/ (Reg_ArtStart = "TDF-FTC-LPV/r" 
| Reg_ArtStart = "TDF-3TC-LPV/r" | Reg_ArtStart = "AZT-3TC-LPV/r" | Reg_ArtStart = "AZT-TDF-FTC-LPV/r" 
| Reg_ArtStart = "AZT-TDF-3TC-LPV/r" | Reg_ArtStart = "TDF-FTC-ATV/r" | Reg_ArtStart = "TDF-3TC-ATV/r" 
| Reg_ArtStart = "AZT-3TC-ATV/r" | Reg_ArtStart = "TDF-3TC-DRV/r" | Reg_ArtStart = "AZT-3TC-DRV/r")
THEN RegLne_ArtStart = "Adult.2nd.Line";


ELSE IF (Age_ArtStaMnts_5_ ^=. OR Age_ArtStart_Yrs <=14) & /* adult 1st line drug class*/ (Reg_ArtStart = "AZT-3TC-NVP" 
| Reg_ArtStart = "AZT-3TC-EFV" | Reg_ArtStart = "D4T-3TC-NVP" | Reg_ArtStart = "D4T-3TC-EFV" 
| Reg_ArtStart = "TDF-3TC-NVP" | Reg_ArtStart = "TDF-3TC-EFV" | Reg_ArtStart = "TDF-FTC-NVP" 
| Reg_ArtStart = "TDF-FTC-EFV" | Reg_ArtStart = "AZT-3TC-ABC" | Reg_ArtStart = "AZT-3TC-TDF")
THEN RegLne_ArtStart = "Peds.1st.Line" & Reg_ArtStart = "AZT-3TC-NVP"; ELSE IF

(Age_ArtStaMnts_5_ ^=. OR Age_ArtStart_Yrs <=14) & /* adult 2nd line drug class*/ (Reg_ArtStart = "TDF-FTC-LPV/r" 
| Reg_ArtStart = "TDF-3TC-LPV/r" | Reg_ArtStart = "AZT-3TC-LPV/r" | Reg_ArtStart = "AZT-TDF-FTC-LPV/r" 
| Reg_ArtStart = "AZT-TDF-3TC-LPV/r" | Reg_ArtStart = "TDF-FTC-ATV/r" | Reg_ArtStart = "TDF-3TC-ATV/r" 
| Reg_ArtStart = "AZT-3TC-ATV/r" | Reg_ArtStart = "TDF-3TC-DRV/r" | Reg_ArtStart = "AZT-3TC-DRV/r")
THEN RegLne_ArtStart = "Peds.2nd.Line" & Reg_ArtStart = "ABC-3TC-LPV/r"; ELSE IF

(Age_ArtStaMnts_5_ =. OR Age_ArtStart_Yrs >14) & /* peads 1st line drug class*/ (Reg_ArtStart = "AZT-3TC-NVP" 
| Reg_ArtStart = "AZT-3TC-EFV" | Reg_ArtStart = "D4T-3TC-NVP" | Reg_ArtStart = "D4T-3TC-EFV" 
| Reg_ArtStart = "ABC-3TC-NVP" | Reg_ArtStart = "ABC-3TC-EFV" | Reg_ArtStart = "ABC-3TC-AZT" 
| Reg_ArtStart = "TDF-3TC-EFV" | Reg_ArtStart = "TDF-3TC-DTG" | Reg_ArtStart = "TDF-3TC-EFV400" 
| Reg_ArtStart = "ABC-3TC-DTG") THEN RegLne_ArtStart = "Adult.1st.Line" & Reg_ArtStart = "AZT-3TC-NVP"; ELSE IF

(Age_ArtStaMnts_5_ =. OR Age_ArtStart_Yrs >14) & /* peads 2nd line drug class*/ (Reg_ArtStart = "ABC-DDI-LPV/r" 
| Reg_ArtStart = "ABC-3TC-LPV/r" | Reg_ArtStart = "AZT-3TC-LPV/r" | Reg_ArtStart = "D4T-3TC-LPV/r" 
| Reg_ArtStart = "DDI-3TC-NVP" | Reg_ArtStart = "ABC-3TC-DDI" | Reg_ArtStart = "TDF-3TC-ATV/r" 
| Reg_ArtStart = "TDF-3TC-RAL" | Reg_ArtStart = "AZT-3TC-RAL") THEN RegLne_ArtStart = "Adult.2nd.Line" 
& Reg_ArtStart = "AZT-3TC-LPV/r";
run;

 

 

 

 

2 REPLIES 2
ballardw
Super User

@Ken_nuga wrote:

Please, I need help ASAP.

I have tried this using SAS 9.4 but the blank spaces remain blank and only the formats changed. Thanks.

 

 


You will likely get quicker help if you provide a description of what needs to be corrected and how to tell if the correction was the right one. I have no clue as to which "blank spaces" might be an issue.

Also your code is nearly useless without a data set to test.

 

First hint: Are you attempting to compare the FORMATTED values of your variables? Comparisons are done with the actual values not the format unless you do something that actually applies the format.

Second: if you want to test if a single variable has a value in a list of values the IN operator is much more compact and may execute quicker:

(Reg_ArtStart in ( "AZT-3TC-NVP"   "AZT-3TC-EFV"   "D4T-3TC-NVP"   "D4T-3TC-EFV" 
                   "ABC-3TC-NVP"   "ABC-3TC-EFV"   "ABC-3TC-AZT"   "TDF-3TC-EFV"   "TDF-3TC-DTG"   "TDF-3TC-EFV400" 
                   "ABC-3TC-DTG")
)

for instance.

 

Which if you need the formatted value of Reg_ArtStart for the comparison would look like:

(put(Reg_ArtStart,$Regimen_start.) in ( "AZT-3TC-NVP"   "AZT-3TC-EFV"   "D4T-3TC-NVP"   "D4T-3TC-EFV" 
                   "ABC-3TC-NVP"   "ABC-3TC-EFV"   "ABC-3TC-AZT"   "TDF-3TC-EFV"   "TDF-3TC-DTG"   "TDF-3TC-EFV400" 
                   "ABC-3TC-DTG")
)

maybe.

 

Ken_nuga
Fluorite | Level 6

Thank you for your prompt response, sorry it`s been a busy reporting period for me. I have data pulled down from a patient-level DB and the format it has for regimen line and regimen (both at ART start and current) are not consistent with the CDC formats e.g. AZT/3TC/NVP or  ZDV/3TC/NVP should both now be AZT-3TC-NVP. The formats actually applied successfully when I attempted to do so. 

The next step will be to identify patient IDs with missing regimen line and fill up accordingly if the regimen is a 1st, 2nd or 3rd line drug based on age at ART start. 

Then, should there be a unique ID where the age at ART start is that of a pediatric (0 to 14 years) but the regimen assigned is an adult drug at ART start (except D4T-3TC-NVP or D4T-3TC-EFV), such should be re-assigned AZT-3TC-NVP. Another scenario is where the patient is a paed and the regimen is a 1st line regimen but the regimen line is missing, such regimen line should be Peds.1st.Line.

 

Below is a sample data:

 

PUID_ARTSexDOBAge_ArtStart_YrsAge_ArtStaMnts_5@ArtStart_DatdmyRegLne_ArtStartReg_ArtStartCurr_RegLineCurr_ART_Reg
179Female    01-Nov-9720 10-Jan-18 ABC/FTC/LPVrAdult.1st.line                                TDF/3TC/EFV
36Male      01-Jan-8235 14-Feb-17Adult.1st.line                                TDF/3TC/EFVAdult.1st.line                                TDF/3TC/EFV
39Male      01-Jan-8829 24-Feb-15Adult.1st.line                                TDF/3TC/EFV ABC/FTC/LPVr
55Female    05-Jul-7737 24-Jan-15Adult.1st.line                                TDF/3TC/EFV ABC/FTC/LPVr
58Female    18-Jun-5658 12-Mar-15 ABC/FTC/LPVr ABC/FTC/LPVr
66Male      11-May-8233 15-May-15Adult.1st.line                                TDF/3TC/EFVAdult.1st.line                                TDF/3TC/EFV
69Female    01-Jan-7936 02-Jul-15 ABC/FTC/LPVr ABC/FTC/LPVr
74Female    01-Jan-7639 31-Jul-15Adult.1st.line                                TDF/3TC/EFVAdult.1st.line                                TDF/3TC/EFV
75Male      01-Jan-8829 01-Aug-15 ABC/FTC/LPVrAdult.1st.line                                TDF/3TC/EFV
77Female    03-Oct-8529 14-Aug-15 ABC/FTC/LPVr ABC/FTC/LPVr
79Male      01-Jan-8235 10-Aug-15 ABC/FTC/LPVr ABC/FTC/LPVr
84Female    26-Feb-8431 11-Nov-15Adult.1st.line                                TDF/3TC/EFV ABC/FTC/LPVr
91Female    01-Jun-7441 26-Nov-15Adult.1st.line                                TDF/3TC/EFVAdult.1st.line                                TDF/3TC/EFV
99Female    21-Sep-8629 02-Nov-15Adult.1st.line                                TDF/3TC/EFVAdult.1st.line                                TDF/3TC/EFV
116Female    05-Mar-9518 12-Feb-13 ABC/DDI/LPVrAdult.1st.lineTDF/3TC/EFV
135Female    04-Mar-9618 25-Jun-14Adult.1st.lineTDF/3TC/EFVAdult.1st.lineTDF/3TC/EFV
137Female    14-Nov-9617 16-Apr-14 ABC/DDI/LPVrAdult.2nd.lineABC/FTC/LPVr
157Female    31-Aug-13 902-Apr-14 ABC/DDI/LPVrAdult.1st.lineTDF/3TC/EFV
159Female    16-Jul-9915 23-Jul-14Adult.2nd.lineABC/DDI/LPVrAdult.2nd.lineABC/DDI/LPVr
163Female    17-Jul-049 31-Jul-13 ZDV/3TC/NVPPeds.1st.lineZDV/3TC/NVP
164Male      04-Mar-0411 18-Sep-13 ZDV/3TC/NVP1st Line                                ZDV/3TC/NVP
177Male      10-Jun-115 03-Feb-16 ZDV/3TC/NVP1st Line                                ZDV/3TC/NVP
187Male      06-Jun-058 01-Oct-13 ZDV/3TC/NVP1st Line                                ZDV/3TC/NVP
2318Female    17-Jul-13 327-Oct-13Adult.1st.lineZDV/3TC/NVPAdult.1st.lineZDV/3TC/NVP
5Female    08-Apr-088 11-Jan-17Adult.1st.lineD4T/3TC/NVP1st Line                                D4T/3TC/NVP
60Female    04-Oct-9616 11-Sep-13 ABC/DDI/LPVrAdult.2nd.lineABC/FTC/LPVr
96Male      10-Oct-13 1417-Dec-14Adult.1st.lineZDV/3TC/NVPAdult.1st.lineZDV/3TC/NVP
102Male      05-Jun-14 1516-Sep-15Adult.1st.lineZDV/3TC/NVPAdult.1st.lineZDV/3TC/NVP

 

Regards.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 932 views
  • 0 likes
  • 2 in conversation