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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 15 replies
  • 8990 views
  • 0 likes
  • 4 in conversation