This may be simple or may not be simple .
%let ID=1000 ;
PROC SQL;
SELECT * FROM TABLE WHERE FORMULARY_ID = INPUT(&ID. ,8.);
QUIT;
the conversion is not working.
in the TABLE the FORMULARY_ID is a Number , how can i convert Macro variable to number ?
any help would be highly appreciated.
Thanks,
M
The INPUT function is expecting a string. So, try this:
%let ID=1000 ;
PROC SQL;
SELECT * FROM TABLE WHERE FORMULARY_ID = INPUT("&ID". ,8.);
QUIT;Of course, you don't need to do that. This should work as well.
%let ID=1000 ; PROC SQL; SELECT * FROM TABLE WHERE FORMULARY_ID = &ID.; QUIT;
HTH
Thanks HTH,
INPUT("&ID".,8.) has worked.
When a macro variable gets passed to a SAS program, it is up to the SAS program to determine whether the value is character or numeric. You could simply use:
where formulary_id=&id.;
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.