DATA Step, Macro, Functions and more

Macro not executing, SAS hangs

Accepted Solution Solved
Reply
Contributor
Posts: 30
Accepted Solution

Macro not executing, SAS hangs

Hi,

I've a data step below, which converts a "wide" table to a "narrow" table. The code in Listing 1 runs fine. However, when I try to make a macro for the same code (see Listing 2), and try to run it. SAS does nothing. No error is given. In fact, I'm unable to submit any other SAS code and have to restart SAS.

Please advise what mistake I am making. Thank you in advance for your help!

Asim

Listing 1:

data MFHoldings_Yield;

    format CUSIP $9. Yield_Date mmddyy10.;

    set MFHoldingsRaw_Yield;

    array Yield_Data{&no_of_yield.} Yield_1 - Yield_&no_of_yield.;

    Yield_date=&start_date_yield.-1;

    do i=1 to &no_of_yield.;

        if not missing(Yield_Data{i}) then do;

            Yield_date=Yield_date+i;

            Yield=Yield_Data{i};

            output;

        end;

    end;

    keep CUSIP Yield_Date Yield;

run;

Listing 2:

%macro createYieldTable(dsn1, dsn2);

    data &dsn2.;

        format CUSIP $9.   Yield_Date mmddyy10.;

        set &dsn1.;

        array Yield_Data{&no_of_yield.} Yield_1 - Yield_&no_of_yield.;

        Yield_date=&start_date_yield.-1;

        do i=1 to &no_of_yield.;

            if not missing(Yield_Data{i}) then do;

                Yield_date=Yield_date+i;

                Yield=Yield_Data{i};

                output;

            end;

        end;

        keep CUSIP Yield_Date Yield;

    run;

%macro createYieldTable;

%createYieldTable(MFHoldingsRaw_Yield, MFHoldings_Yield);


Accepted Solutions
Solution
‎07-03-2015 11:52 AM
Super User
Posts: 5,256

Re: Macro not executing, SAS hangs

You should end your macro definition by a %mend statement, not another %macro.

Data never sleeps

View solution in original post


All Replies
Solution
‎07-03-2015 11:52 AM
Super User
Posts: 5,256

Re: Macro not executing, SAS hangs

You should end your macro definition by a %mend statement, not another %macro.

Data never sleeps
Contributor
Posts: 30

Re: Macro not executing, SAS hangs

Linus, many thanks! Smiley Happy

☑ This topic is SOLVED.

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

Discussion stats
  • 2 replies
  • 193 views
  • 0 likes
  • 2 in conversation