I have no issues running these codes below . But it seems I didn’t create the “antibiotics_flag" variable in my data, I just have the label, so every time I will have to re-run the whole codes (I have 20 codes blocks like this). Is there a way to save the “antibiotics_flag" as a permanent variable in my datasets?
data kid2012;
set Kid_2012_core;
array diagvar $ dx1-dx25;
label antibiotics_flag = "Diagnosis code for antibiotics ADE";
antibiotics_flag = 0;
do over diagvar;
if diagvar ="76074" or "9600 "=<diagvar<= "9609 " or diagvar="E856 " or "E9300 "=<diagvar<= "E9306 " or "E9308 "=<diagvar<= "E9309 "
or diagvar= "E9310 " or diagvar= "E9313 "
then antibiotics_flag = 1;
end;
PROC SURVEYFREQ DATA=kid2012;
WEIGHT DISCWT;
CLUSTER HOSP_KID ;
STRATA KID_STRATUM ;
table antibiotics_flag;
run;
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.