Creating a macro Variable using %Let statement.

Accepted Solution Solved
Reply
Contributor
Posts: 66
Accepted Solution

Creating a macro Variable using %Let statement.

Is it possible to create  a macro variable this way

%LET  i= 40 LT  Score LE 60;

So that if I have a data set  have

Data have;

INPUT SN Score;

DATALINES;

1     25

2     30

3     80

4     76

5     35

6     50

7     40

8     35

  And Want,

DATA Want;

SET Have;

Where &I;

RUN;

I made some silly attempts, does not seem to work.

Any help would be highly appreciated!


Accepted Solutions
Solution
‎08-02-2013 09:31 AM
Super Contributor
Posts: 644

Re: Creating a macro Variable using %Let statement.

This error is usually generated when you forget the semicolon on the end of a macro statement.

Close your session and start afresh. 

BTW a closer look at your code would lead me to retract my previous "guess". 

It should work in a new session.

Richard

View solution in original post


All Replies
Super Contributor
Posts: 644

Re: Creating a macro Variable using %Let statement.

Show us the error messages you are getting.

At a guess, it might work with %LET SN = etc etc ;

Richard

Contributor
Posts: 66

Re: Creating a macro Variable using %Let statement.

This is the error

 

ERROR: Open code statement recursion detected.

Solution
‎08-02-2013 09:31 AM
Super Contributor
Posts: 644

Re: Creating a macro Variable using %Let statement.

This error is usually generated when you forget the semicolon on the end of a macro statement.

Close your session and start afresh. 

BTW a closer look at your code would lead me to retract my previous "guess". 

It should work in a new session.

Richard

Contributor
Posts: 66

Re: Creating a macro Variable using %Let statement.

Thanks Richard!

Silly me!!!

☑ This topic is SOLVED.

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

Discussion stats
  • 4 replies
  • 164 views
  • 0 likes
  • 2 in conversation