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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 665 views
  • 1 like
  • 3 in conversation