%let a=2 here a is a macro variable and is character and if i write ths
proc print data=data;
where rating=&a;
run;
then records with rating=2 is coming.How ths character is getting resolved as numeric over here?
"Macro variables contain only character data. However, the macro facility has features that enable a variable to be evaluated as a number when it contains character data that can be interpreted as a number."
SAS language can interpret 2 as either character or numeric, depending on the context:
xrays=2;
robot='R2D2';
Macro language is not determining whether "2" is character or numeric. It is merely substituting "2" into the program, making it:
proc print data=data;
where rating=2;
run;
SAS language then interprets the program, and decides what each word means.
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.