The following code checks whether an exposure value is less than 0 or . and if it is makes it 0. It then puts this into a new field called Raw_Agg_ and whatever the user puts in the variable cov, but I am unable to get SAS to create a new column header out of Raw_Agg_ and the macro variable cov
%macro expo_check(exposure_field, cov); if &exposure_field. < 0 or &exposure_field. = . then Raw_Agg_ || &cov. = 0; run; %mend;
Any help would be greatly appreciated.
Thanks
You don't need the concatenation operator.
%macro expo_check(exposure_field, cov);
if &exposure_field. < 0 or &exposure_field. = . then Raw_Agg_&cov. = 0;
run;
%mend;
You don't need the concatenation operator.
%macro expo_check(exposure_field, cov);
if &exposure_field. < 0 or &exposure_field. = . then Raw_Agg_&cov. = 0;
run;
%mend;
Thanks, that was easy I was trying all sorts of other complicated stuff.
You probably don't need the run statement either. It should reside in the calling scope.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.