First, I'm creating a new dataset with new names for some variables. Dropping unwanted variables data q2; set METSdata.LABA_669; rename LABA11 = SODIUM LABA15 = CALCIUM LABA16 = PROTEIN LABA5 = HDL LABA6 = LDL; keep BID VISIT LABA11 LABA15 LABA16 LABA5 LABA6; run; proc print data=q2 (obs=20); run; The dataset contains a lot of . values. I want to categorize numeric&. values into within a range and outside of the range, by labeling them Missing, Low, Normal (within range), and High. I'm using different categories for different variables (such as sodium (SOD), calcium(CAL), etc) proc format; value SOD . = 'Missing' Low-129 = 'Low' 130<-<150 = 'Normal' 151-High = 'High'; run; proc format; value CAL . = 'Missing' Low-7= 'Low' 8<-<10.5 = 'Normal' 11-High = 'High'; run; proc format; value PRO . = 'Missing' Low-5 = 'Low' 6<-<9 = 'Normal' 10-High = 'High'; run; proc format; value HDL . = 'Missing' Low-24 = 'Low' 25-High = 'Normal'; run; proc format; value LDL . = 'Missing' Low-200 = 'Normal' 201-High = 'High'; run; Then onto macro function - I'm creating a function such that if I type Sodium, Calcium, etc, the function will create a categorical variable, which is a categorized version of the numeric&. values accordingly to the input name, then print BID VISIT &name. and valcat variables of that input name. %macro analyte(name=); data &name.; set q2; valcat = &name.; %if upcase(&name.) = SODIUM %then %put %sysfunc(putn(&valcat, SOD.)); %if upcase(&name.) = CALCIUM %then %put %sysfunc(putn(&valcat, CAL.)); %if upcase(&name.) = PROTEIN %then %put %sysfunc(putn(&valcat, PRO.)); %if upcase(&name.) = HDL %then %put %sysfunc(putn(&valcat, HDL.)); %else upcase(&name.) = LDL %put %sysfunc(putn(&valcat, LDL.)); keep BID VISIT &name. valcat; run; proc print data = &name.; run; %macro analyte; %analyte(sodium); I don't get any output from this macro function though. Any help please? Thank you in advance!
... View more