Date: Mon, 7 Aug 2006 12:40:52 -0700
Reply-To: Frank Poppe <Frank.Poppe@PWCONS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Frank Poppe <Frank.Poppe@PWCONS.COM>
Organization: http://groups.google.com
Subject: Re: Assigning Format
In-Reply-To: <1154933820.276513.241010@n13g2000cwa.googlegroups.com>
Content-Type: text/plain; charset="iso-8859-1"
Hello Hari,
The pieces of code you show look OK to me, and I'd say that they should
do what you expect. But clearly something is preventing that.
Could you please show a SAS log that shows:
1- that data set A has the formats associated to the variables
2- that SAS can use those formats for data set A
3- the creation of B from A
4- that SAS cannot use the same formats for data set B although they
still exist and are still pointed to by the FMTSEARCH option
A PROC DATASETS should not be necessary.
Frank Poppe
Hari wrote:
> Scott Bass wrote:
> > Hari,
> >
> > If you have permanent user-defined formats associated with variables in a
> > dataset, you need to ensure:
> >
> > * the formats exist in a formats catalog
> > * the format catalog is in the current fmtsearch path
> >
> > when you attempt to access the dataset.
> >
>
> I use the following option
> Options FMTsearch = (FmtProj.FmtProjA);
> options nofmterr;
>
> But inspite of the above when I create new datsets based on old, the
> variables which have not been transformed do not retain their formats
> from the format catalog of the parent data set. The new data set does
> show that the variabl called PID has a user defined format PIDCS but
> the new data set is not able to read PIDCS. fromat from
> FmtProj.FmtProjA
>
> A new issue - I see that if I try to assign formats using Proc Datasets
> and Modify along with Format statement then formats get assigned
> correctly. Like in the following case I generated data set A after
> converting a SPSS file (POR) and now am assigning formats to the file.
>
> proc datasets library = ProjA;
> modify DatasetA;
> Format PID $PIDCS.;
> Quit;
>
> But if I try to do the above using Data steps then it doesnt work.
>
> Data ProjA.DatasetA;
> Set ProjA.DatasetA;
> Format PID $PIDCS.;
> run;
>
> I get same error messages as before.
>
> I read that assigning formats through Data steps permenantly associates
> the formats with data file. But why is it that am not able to work it
> out.
>
> Also, is my usage of Proc Datasets -- Modify -- Fomats -- method a
> correct one. I thought that by doing this I would be able to
> permanently associate the variable formats with the Dataset. But every
> time I start a new session of SAS am forced to re-run the Proc Datasets
> code. Why is it so?
>
> Regards,
> HP
> India
>
> > Read the doc for the fmtsearch option, paying close attention to the search
> > rules for the LIBRARY and WORK librefs.
> >
> > If the creation of data set B fails, try viewtable A, and see if your data
> > is formatted as expected. You could also run the code (untested):
> >
> > proc format lib=fmtproj.formats cntlout=test; /* change the catalog name as
> > appropriate */
> > select pidcs;
> > run;
> >
> > which would 1) display the values of your format and 2) test your current
> > fmtsearch path.
> >
> > HTH,
> > Scott
> >
> > "Hari" <excel_hari@yahoo.com> wrote in message
> > news:1154900050.976359.178660@75g2000cwc.googlegroups.com...
> > > Hi,
> > >
> > > I have a Datset A (in library ProjA) having some user defined formats
> > > with its format catalog
> > > (FmtProjA) in a library called FmtProj and I have associated the format
> > > of the dataset with the catalog in FmtProj.
> > >
> > > Now, I create a new data set called B from A (data ProjA.B; Set
> > > ProjA.A;run;) and I see that the formats in B do not get assigned
> > > automatically from the formats in dataset A. I get messages like
> > >
> > > "NOTE: Format PIDCS was not found or could not be loaded."
> > >
> > > Because of this am forced to explicitly associate the FmtProjA to
> > > dataset B using Proc datasets statement. Shouldnt SAS associate the
> > > formats for derived datasets by default?
> > >
> > > Regards,
> > > HP
> > > India
> > >
|