I have the following programs:. The nonmacro part works but the macro doesn't work. This is the note from log:
Table WORK.ETG_999900 created, with 0 rows and 5 columns. I can't figure out why it gives me nothing. Any suggestions/solutions will be greatly appreciated!
libname Store "\\nasnpmmds\EBI1\mmds\AHCPII\OPTUMCheck";
PROC SQL;
CREATE TABLE WORK.ETG_999900 AS
SELECT t1.ETG_NBR,
t1.EPI_TYPE_KEY,
t1.EPI_NBR,
/* DESC */
('Orphan Record') AS DESC,
/* Short_ETG */
(substr(t1.ETG_NBR, 1, 6)) AS Short_ETG
FROM store.lost_claims_91 t1
WHERE (CALCULATED Short_ETG) = '999900'
ORDER BY t1.EPI_TYPE_KEY,
t1.EPI_NBR;
QUIT;
%macro ETG(DESC, ETG);
PROC SQL;
CREATE TABLE WORK.ETG_&ETG AS
SELECT t1.ETG_NBR,
t1.EPI_TYPE_KEY,
t1.EPI_NBR,
/* DESC */
('&DESC') AS DESC,
/* Short_ETG */
(substr(t1.ETG_NBR, 1, 6)) AS Short_ETG
FROM Store.lost_claims_91 t1
WHERE (CALCULATED Short_ETG) = '&ETG'
ORDER BY t1.EPI_TYPE_KEY,
t1.EPI_NBR;
QUIT;
%mend ETG;
%ETG(Orphan Record, 999900)
I just figured out why my macro did not work. I have to use " " instead of ' '.
@zhuxiaoyan1 wrote:
I just figured out why my macro did not work. I have to use " " instead of ' '.
Mark this post as the "solution" so folks know the issue was answered.
In the future please post code and/or log text into a code box such as is opened with the forums {I} or "running man" icon.
the code boxes will preserve formatting (indenting and such) and make things easier to read. Also many error messages have indicators where the error is recognized by SAS but the main message windows will reformat text to move the diagnostic characters.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.