BookmarkSubscribeRSS Feed
ZRick
Obsidian | Level 7

%let fname=&dataroot&psep.st_26.csv;

%macro TABLES;

    %if %sysfunc(fexist(&fname)) %then

    %do;

        filename st_spec &fname;

            data st_26;

               infile st_spec dsd firstobs=2 truncover dlm=',';

               input date:mmddyy10.;

        run;

    %end;

    %else %do;

        %put No schedule table exists;

    %end;

%mend

In a call to the FEXIST routine, the fileref       /home/rwn/ksde/data/ftp/st_26.csv exceeds 8 characters,   and will be truncated.

Because of this, it is returned the wrong result.

how do I fix it?

2 REPLIES 2
shivas
Pyrite | Level 9

Hi,

Try this...Hope it helps..

%let fname=&dataroot&psep.st_26.csv;

%macro TABLES;

filename st_spec "&fname";

    %if %sysfunc(fexist(&fname)) %then

    %do;       

            data st_26;

               infile st_spec dsd firstobs=2 truncover dlm=',';

               input date:mmddyy10.;

        run;

    %end;

    %else %do;

        %put No schedule table exists;

    %end;

%mend;

%tables;

Thanks,

Shiva

Ksharp
Super User

Use fileexist() to replace fexist().

Ksharp

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