LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 21 Oct 2004 06:56:50 -0700
Reply-To:     KrzysOPoranku <krzysoporanku@INTERIA.PL>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         KrzysOPoranku <krzysoporanku@INTERIA.PL>
Organization: INTERIA.PL -> http://www.interia.pl
Subject:      Re: How can I create Macro variables using x command???
Content-Type: text/plain; charset=ISO-8859-2; format=flowed

W li¶cie z dnia 2004-10-21 02:57, Saqi napisał(a):

> Dear SAS-Lers, > > I have 5 sub-directories in saslogs directory. I would like to to use > x command and insert the resulting value of x command into a sas macro > variable. Can anyone please suggest how can I do that??? or is there > any other way to get the most recent created log file from those > directories. > > Every day new logs are created in these directories. I would like to > pick the latest on using the following unix commands: > > x '`ls -t /sas/sas82/saslogs/job1/job1* | head -1`'; > > /sas/sas82/saslogs/job1/ > /sas/sas82/saslogs/job2/ > /sas/sas82/saslogs/job3/ > /sas/sas82/saslogs/job4/ > /sas/sas82/saslogs/job5/ > > Thanks in Advance > > Jan

Try sth like that (not tested!):

filename loglst pipe 'ls -t /sas/sas82/saslogs/job1/job1* | head -1';

data _null_; infile loglst lrecl=512 end=eof; input; if eof then call symput ('lastlog',_infile_); run;

filename dirlst clear;

%put &lastlog;

Krzys o Poranku P.S>I think that, you can also write a macro without "data _null_;...;run;" statement.


Back to: Top of message | Previous page | Main SAS-L page