Hi ALL,
Am trying to learn Macros and got stuck in the very first code because its not giving any output/result..
%MACRO PRNT(ABC);
PROC PRINT DATA=&ABC;
RUN;
%MEND PRNT;
%PRNT(SASHELP.CLASS);
do i need to change the result/output setting from preferences?
how do i rectify this?
thanks,
Eram.
log doesnt say anything, just the typed macro is coming in log window with out any error, warning or note
SAS 9.3, but am working on VMware.
Tried couple of times to run the macro using different conbinations but still no result but the log is showing only the Macro typed by me without any error or warning..
also the proc print step is coming in black color rather than blue- inside the the macro, is that ok?
2580 %MACRO PRNT_DT (ABC, V1, V2);
2581 PROC PRINT DATA=&ABC;
2582 VAR &V1 &V2;
2583 %MEND;
2584 %MACRO PRNT_DT = (CARS, MAKE, ORIGIN);
ERROR: Expected semicolon not found. The macro will not be compiled.
ERROR: A dummy macro will be compiled.
2585 %MACRO PRNT_DT (ABC, V1, V2);
2586 PROC PRINT DATA=&ABC;
2587 VAR &V1 &V2;
2588 RUN;
2589 %MEND;
2591 %PRNT_DT = (CARS, MAKE, ORIGIN);
2592 %MACRO PRNT_DT (ABC, V1, V2);
2593 PROC PRINT DATA=&ABC;
2594 VAR &V1 &V2;
2595 RUN;
2596 %MEND PRNT_DT;
2602 %PRNT;
2603 %MACRO PRNT(ABC);
2604 PROC PRINT DATA=&ABC;
2605 RUN;
2606 %MEND PRNT;
2607 %PRNT(CARS);
2608 %PRNT(CARS);
2609 %PRNT(SASHELP.CLASS);
2610 %PRNT(SASHELP.CLASS);
2611 %MACRO PRNT(ABC);
2612 PROC PRINT DATA=&ABC;
2613 RUN;
2614 %MEND PRNT;
2616 %PRNT(SASHELP.CLASS);
Tried closing the session again and relogged in, Macro working fine now..
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.