Hello, Expert, I have a simple question. I established a query to store the value (which will be changed under specific condition), and then want to give this value to variable J which will be used by other Macros. I was using '&let' but system showed wrong. Can you give me some advice, still a newbee to SAS.
PROC SQL;
CREATE TABLE WORK.Number AS
SELECT (MAX(t1.'Primary ID'n)) FORMAT=BEST12. AS RowNum
FROM WORK.modeltraining_blocked t1;
QUIT;
%let j=int(number.Rownum/7);
proc print data=work.number.rownum;
To put the value from a SQL query into a macro variable, use the INTO : clause
PROC SQL;
SELECT int( MAX('Primary ID'n) / 7) into : J
FROM modeltraining_blocked;
QUIT;
To put the value from a SQL query into a macro variable, use the INTO : clause
PROC SQL;
SELECT int( MAX('Primary ID'n) / 7) into : J
FROM modeltraining_blocked;
QUIT;
PROC SQL;
SELECT MAX(t1.'Primary ID'n/7) FORMAT=BEST12. into :RowNum
FROM WORK.modeltraining_blocked t1;
QUIT;
%put &rownum.;
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.