Date: Thu, 13 Dec 2007 07:55:01 -0600
Reply-To: "data _null_," <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_," <datanull@GMAIL.COM>
Subject: Re: SORTING SAS DATASETS IN A UNIX DATA DIRECTORY
In-Reply-To: <CA8F89971ADA9F47A6C915BA2397844207B422E0@MAILBE2.westat.com>
Content-Type: text/plain; charset=ISO-8859-1
I'm thinkin LIBNAME='MYDATA' might be more appropriate, given the code posted.
On Dec 12, 2007 9:40 PM, Sigurd Hermansen <HERMANS1@westat.com> wrote:
> Try ... where libname='WORK' (DICTIONARY dataset libraries and column
> names always in upper case).
> S
>
>
> -----Original Message-----
> From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]
> On Behalf Of SUBSCRIBE SAS-L Chandra Gadde
> Sent: Wednesday, December 12, 2007 10:15 PM
> To: SAS-L@LISTSERV.UGA.EDU; Richard A. DeVenezia
> Subject: Re: SORTING SAS DATASETS IN A UNIX DATA DIRECTORY
>
>
> Richard,
>
> I have this error message.
>
> 1 libname mydata '/home/t11/jobs';
> NOTE: Libref MYDATA was successfully assigned as follows:
> Engine: V9
> Physical Name: /home/t11/jobs
> 2 proc sql noprint;
> 3 select
> 4 cats(libname,'.',memname) format=$41.
> 5 , input(scan(memname,-1,'_'),date7.) as date format=date7.
> 6 into
> 7 :table
> 8 , :date
> 9 from
> 10 dictionary.tables
> 11 where libname='work'
> 12 and memname like 'A_%'
> 13 having date=max(date)
> 14 ;
> NOTE: The query requires remerging summary statistics back with the
> original data.
> NOTE: No rows were selected.
> 15 quit;
> NOTE: PROCEDURE SQL used (Total process time):
> real time 0.02 seconds
> cpu time 0.02 seconds
>
>
> WARNING: Apparent symbolic reference TABLE not resolved.
> WARNING: Apparent symbolic reference DATE not resolved.
> 16 %put &table | &date;
> &table | &date
>
> On Wed, 12 Dec 2007 19:44:21 -0500, Richard A. DeVenezia
> <rdevenezia@WILDBLUE.NET> wrote:
>
> >Chandra Gadde wrote:
> >> Hi All,
> >>
> >>
> >> I have several sas datasets in one unix data directory. Some of them
> >> follow this pattern.
> >>
> >> job_claim_10dec07.sas7bdat
> >> job_claim_11jan07.sas7bdat
> >> job_claim_22jun05.sas7bdat
> >> job_claim_11nov07.sas7bdat
> >> job_claim_19mar06.sas7bdat
> >>
> >>
> >>
> >> and so forth.
> >>
> >> I need to sort these data sets, in the ascending order of DDMONYY
> >> extension. In other words, after sorting I should see the sas
> >> datasets in the following way and pick up the latest sas program. My
> >> goal is to identify the latest SAS dataset being created. I need to
> >> identify the latest SAS dataset and use that in my new sas PROGRAM I
> >> am creating. Any help would be greatly appreciated.
> >>
> >> job_claim_22jun05.sas7bdat
> >> job_claim_19mar06.sas7bdat
> >> job_claim_11jan07.sas7bdat
> >> job_claim_11nov07.sas7bdat
> >> job_claim_10dec07.sas7bdat
> >
> >libname mydata "path to directory";
> >
> >proc sql noprint;
> > select
> > cats(libname,'.',memname) format=$41.
> > , input(scan(memname,-1,'_'),date7.) as date format=date7.
> > into
> > :table
> > , :date
> > from
> > dictionary.tables
> > where libname="WORK"
> > and memname like 'A_%'
> > having date=max(date)
> > ;
> >quit;
> >
> >%put &table | &date;
> >
> >
> >--
> >Richard A. DeVenezia
> >http://www.devenezia.com/
>
|