Macro - Results not updating

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 11
Accepted Solution

Macro - Results not updating

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.

 


Accepted Solutions
Solution
‎06-03-2017 08:34 AM
Occasional Contributor
Posts: 11

Re: Macro - Results not updating

Closed the SAS session, started a new SAS session and gave the same code, now log says, it couldn't find the variables
2208 %MACRO PRNT(ABC, V1, V2);
2209 PROC PRINT DATA=&ABC;
2210 VAR V1 V2;
2211 RUN;
2212 %MEND PRNT;

2213 %PRNT(CARS, MAKE, ORIGIN);
ERROR: Variable V1 not found.
ERROR: Variable V2 not found.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds



2214 %PRNT(WORK.CARS, MAKE, ORIGIN);
ERROR: Variable V1 not found.
ERROR: Variable V2 not found.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds



2215 %PRNT(WORK.CARS, Make, Origin);
ERROR: Variable V1 not found.
ERROR: Variable V2 not found.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

View solution in original post


All Replies
Trusted Advisor
Posts: 1,137

Re: Macro - Results not updating

Could you please show the log. Is there any error or warning or a note in log. it appears the macro code is correct and when I executed it generated the output in result window
Thanks,
Jag
Occasional Contributor
Posts: 11

Re: Macro - Results not updating

log doesnt say anything, just the typed macro is coming in log window with out any error, warning or note

Trusted Advisor
Posts: 1,137

Re: Macro - Results not updating

may I know the sas version you are working
Thanks,
Jag
Occasional Contributor
Posts: 11

Re: Macro - Results not updating

SAS 9.3, but am working on VMware.

Occasional Contributor
Posts: 11

Re: Macro - Results not updating

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);

Solution
‎06-03-2017 08:34 AM
Occasional Contributor
Posts: 11

Re: Macro - Results not updating

Closed the SAS session, started a new SAS session and gave the same code, now log says, it couldn't find the variables
2208 %MACRO PRNT(ABC, V1, V2);
2209 PROC PRINT DATA=&ABC;
2210 VAR V1 V2;
2211 RUN;
2212 %MEND PRNT;

2213 %PRNT(CARS, MAKE, ORIGIN);
ERROR: Variable V1 not found.
ERROR: Variable V2 not found.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds



2214 %PRNT(WORK.CARS, MAKE, ORIGIN);
ERROR: Variable V1 not found.
ERROR: Variable V2 not found.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds



2215 %PRNT(WORK.CARS, Make, Origin);
ERROR: Variable V1 not found.
ERROR: Variable V2 not found.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

Occasional Contributor
Posts: 11

Re: Macro - Results not updating

Tried closing the session again and relogged in, Macro working fine now..

Super User
Posts: 19,167

Re: Macro - Results not updating

@Eram that code is still incorrect. 

 

You're missing the & in front of the v1 and v2. 

Occasional Contributor
Posts: 11

Re: Macro - Results not updating

Kyle you pls type in the whole program for me?
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 9 replies
  • 270 views
  • 0 likes
  • 3 in conversation