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-NVP" "TDF/3TC/EFV"="TDF-3TC-EFV"
"TDF/FTC/N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TC-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;
@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.
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_ART | Sex | DOB | Age_ArtStart_Yrs | Age_ArtStaMnts_5@ | ArtStart_Datdmy | RegLne_ArtStart | Reg_ArtStart | Curr_RegLine | Curr_ART_Reg |
179 | Female | 01-Nov-97 | 20 | 10-Jan-18 | ABC/FTC/LPVr | Adult.1st.line | TDF/3TC/EFV | ||
36 | Male | 01-Jan-82 | 35 | 14-Feb-17 | Adult.1st.line | TDF/3TC/EFV | Adult.1st.line | TDF/3TC/EFV | |
39 | Male | 01-Jan-88 | 29 | 24-Feb-15 | Adult.1st.line | TDF/3TC/EFV | ABC/FTC/LPVr | ||
55 | Female | 05-Jul-77 | 37 | 24-Jan-15 | Adult.1st.line | TDF/3TC/EFV | ABC/FTC/LPVr | ||
58 | Female | 18-Jun-56 | 58 | 12-Mar-15 | ABC/FTC/LPVr | ABC/FTC/LPVr | |||
66 | Male | 11-May-82 | 33 | 15-May-15 | Adult.1st.line | TDF/3TC/EFV | Adult.1st.line | TDF/3TC/EFV | |
69 | Female | 01-Jan-79 | 36 | 02-Jul-15 | ABC/FTC/LPVr | ABC/FTC/LPVr | |||
74 | Female | 01-Jan-76 | 39 | 31-Jul-15 | Adult.1st.line | TDF/3TC/EFV | Adult.1st.line | TDF/3TC/EFV | |
75 | Male | 01-Jan-88 | 29 | 01-Aug-15 | ABC/FTC/LPVr | Adult.1st.line | TDF/3TC/EFV | ||
77 | Female | 03-Oct-85 | 29 | 14-Aug-15 | ABC/FTC/LPVr | ABC/FTC/LPVr | |||
79 | Male | 01-Jan-82 | 35 | 10-Aug-15 | ABC/FTC/LPVr | ABC/FTC/LPVr | |||
84 | Female | 26-Feb-84 | 31 | 11-Nov-15 | Adult.1st.line | TDF/3TC/EFV | ABC/FTC/LPVr | ||
91 | Female | 01-Jun-74 | 41 | 26-Nov-15 | Adult.1st.line | TDF/3TC/EFV | Adult.1st.line | TDF/3TC/EFV | |
99 | Female | 21-Sep-86 | 29 | 02-Nov-15 | Adult.1st.line | TDF/3TC/EFV | Adult.1st.line | TDF/3TC/EFV | |
116 | Female | 05-Mar-95 | 18 | 12-Feb-13 | ABC/DDI/LPVr | Adult.1st.line | TDF/3TC/EFV | ||
135 | Female | 04-Mar-96 | 18 | 25-Jun-14 | Adult.1st.line | TDF/3TC/EFV | Adult.1st.line | TDF/3TC/EFV | |
137 | Female | 14-Nov-96 | 17 | 16-Apr-14 | ABC/DDI/LPVr | Adult.2nd.line | ABC/FTC/LPVr | ||
157 | Female | 31-Aug-13 | 9 | 02-Apr-14 | ABC/DDI/LPVr | Adult.1st.line | TDF/3TC/EFV | ||
159 | Female | 16-Jul-99 | 15 | 23-Jul-14 | Adult.2nd.line | ABC/DDI/LPVr | Adult.2nd.line | ABC/DDI/LPVr | |
163 | Female | 17-Jul-04 | 9 | 31-Jul-13 | ZDV/3TC/NVP | Peds.1st.line | ZDV/3TC/NVP | ||
164 | Male | 04-Mar-04 | 11 | 18-Sep-13 | ZDV/3TC/NVP | 1st Line | ZDV/3TC/NVP | ||
177 | Male | 10-Jun-11 | 5 | 03-Feb-16 | ZDV/3TC/NVP | 1st Line | ZDV/3TC/NVP | ||
187 | Male | 06-Jun-05 | 8 | 01-Oct-13 | ZDV/3TC/NVP | 1st Line | ZDV/3TC/NVP | ||
2318 | Female | 17-Jul-13 | 3 | 27-Oct-13 | Adult.1st.line | ZDV/3TC/NVP | Adult.1st.line | ZDV/3TC/NVP | |
5 | Female | 08-Apr-08 | 8 | 11-Jan-17 | Adult.1st.line | D4T/3TC/NVP | 1st Line | D4T/3TC/NVP | |
60 | Female | 04-Oct-96 | 16 | 11-Sep-13 | ABC/DDI/LPVr | Adult.2nd.line | ABC/FTC/LPVr | ||
96 | Male | 10-Oct-13 | 14 | 17-Dec-14 | Adult.1st.line | ZDV/3TC/NVP | Adult.1st.line | ZDV/3TC/NVP | |
102 | Male | 05-Jun-14 | 15 | 16-Sep-15 | Adult.1st.line | ZDV/3TC/NVP | Adult.1st.line | ZDV/3TC/NVP |
Regards.
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 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.