BookmarkSubscribeRSS Feed
dcruik
Lapis Lazuli | Level 10

Then the macro code I provided above will get you that.  Below is the log from testing it.

 

When there was no work.data1 data set:

15         %macro dsexist(dsname=,dslib=);
16         
17         %put &dslib..&dsname outputflag = %sysfunc(exist(&dslib..&dsname));
18         
19         %mend;
20         
21         %dsexist(dsname=data1,dslib=work);
data1.work outputflag = 0

22

 

When there was a work.data1 data set:

15         %macro dsexist(dsname=,dslib=);
16         
17         %put &dslib..&dsname outputflag = %sysfunc(exist(&dslib..&dsname));
18         
19         %mend;
20         
21         %dsexist(dsname=data1,dslib=work);
work.data1 outputflag = 1
22

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
  • 15 replies
  • 10762 views
  • 0 likes
  • 4 in conversation