BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rnmishra
Calcite | Level 5

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!

1 ACCEPTED SOLUTION

Accepted Solutions
RichardinOz
Quartz | Level 8

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

4 REPLIES 4
RichardinOz
Quartz | Level 8

Show us the error messages you are getting.

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

Richard

rnmishra
Calcite | Level 5

This is the error

 

ERROR: Open code statement recursion detected.

RichardinOz
Quartz | Level 8

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

rnmishra
Calcite | Level 5

Thanks Richard!

Silly me!!!

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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