BookmarkSubscribeRSS Feed
NN
Quartz | Level 8 NN
Quartz | Level 8

Hi All,

I have a url for example

http://myserver:81/path/

When i open this path on an internet explorer i can see all the .txt files available in this directory. It appears as a complete list with file name,  created date etc:

I wish to know using sas can we list out all the files present in this path.

Kindly guide or any references will also help.

Thanks..

3 REPLIES 3
Ksharp
Super User

There is an example in Arthur.T 's paper at SGF2012 (Sometimes One Needs an Option with Unusual Dates) .

The following is a code fragment from his Paper .

This remind me that I haven't see him for a long time at this forum .

%macro getcdates;

  %do i=1901 %to 2100;

    filename lunar http

"http://www.hko.gov.hk/gts/time/calendar/text/T&i.e.txt";

    data temp;

      format Gregorian_date yymmdd10.;

      infile lunar dlm=' ' firstobs=3 truncover expandtabs ;

      input Gregorian_date : ?? yymmdd12. lunar_date & $40.

            day_of_week : $20.            solar_term &  $40.;

      if not missing(Gregorian_date) then output;

    run;

    proc append base=dates data=temp; run;

  %end;

Ksharp

NN
Quartz | Level 8 NN
Quartz | Level 8

Thanks Ksharp..

I already had a program like above in place ....

But the restriction of this is that we are assuming the Files name to be in a specified format.

My concern was that if the files had random names would i be able to list all these files...

Ksharp
Super User

Yes. You can extract these file name from you URL firstly, then feed them to a seriers of macro variables and you can input them. Like something:

filename x url 'http://www.hko.gov.hk/gts/time/calendar/text/';
data _null_;
 infile x length=len;
 input x $varying200. len;
 /*Code here to extract the file name you need */
run;

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 978 views
  • 3 likes
  • 2 in conversation