Date: Sun, 6 Aug 2006 23:57:00 -0700
Reply-To: Hari <excel_hari@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Hari <excel_hari@YAHOO.COM>
Organization: http://groups.google.com
Subject: Re: Assigning Format
In-Reply-To: <44d6896c$0$25276$afc38c87@news.optusnet.com.au>
Content-Type: text/plain; charset="iso-8859-1"
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
> >