BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi, Can any one post me the code on how to find out wheather an external file exists or not if yes then the code should open the file automatically i have tried it using FEXIST but its not opening my file
3 REPLIES 3
deleted_user
Not applicable
hi,

use fExist to check external file and if exists, use wBrowse command

e.g.:

dm "wbrowse 'c:\temp\aaaa.xls'";

M.
deleted_user
Not applicable
> hi,
>
> use fExist to check external file and if exists, use
> wBrowse command
>
> e.g.:
>
> dm "wbrowse 'c:\temp\aaaa.xls'";
>
> M.

This is not necessarily the best way.
FEXIST check's for the existence of an "external" file through a FILEREF. FILEEXIST checks for the existence of an external file, given the file's or directory's (folder's) name. To get a fileref, you have to have assigned the reference first, using a FILENAME statement or a FILENAME function. It would be more appropriate to use FILEEXIST before ever attempting to use FILENAME.

The FILE statement "opens" a file in a datastep.
FOPEN also opens a file, but why would you want to use this?
deleted_user
Not applicable
What are you trying to do?
Why do you think you need to use fexist?
What do you think you mean by opening a file?
Why do you want to manually manage this yourself?
Have you actually read the SAS documentation for fexist?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 3 replies
  • 764 views
  • 0 likes
  • 1 in conversation