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.;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.