BookmarkSubscribeRSS Feed
BrahmanandaRao
Lapis Lazuli | Level 10

1.How many ways to create Global macro variables what are those can anyone explain examples

 

2.

data dsn;
input name $ city $;
if city='hyd';
/*where city='hyd';
datalines;
ram blr
ravi chennai
krish vja
kesav hyd
;
run;


*HERE IF WORKS AND WHERE NOT WORKS IN DATALINES






2 REPLIES 2
andreas_lds
Jade | Level 19

Maxim 1

Read the documentation.

SAS provides extremely well done documentation for its products. Learning to read the documentation will enhance your problem-solving skills by orders of magnitude.

from https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers...

Kurt_Bremser
Super User

I changed your subject line because your question has got nothing to do with macro variables.

 

As already stated, Maxim 1 is king here:

WHERE Statement 

Study it, and you will find why WHERE cannot work in a data step that reads data only from DATALINES or INFILEs.

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
  • 2 replies
  • 747 views
  • 1 like
  • 3 in conversation