Date: Wed, 20 Feb 2008 14:37:43 -0800
Reply-To: "Duell, Bob" <BD9439@ATT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Duell, Bob" <BD9439@ATT.COM>
Subject: Re: help on attributes - data step
In-Reply-To: A<200802202157.m1KL3ajq001046@mailgw.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"
Either of the following should do the trick:
1. Change the name of the SAS catalog containing your formats to
FORMATS:
PROC FORMAT LIBRARY = a.formats;
2. Change your FMTSEARCH option to point to the complete catalog
reference:
OPTIONS FMTSEARCH=(A.MYFMT)
Bob
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Sophia Tong
Sent: Wednesday, February 20, 2008 1:58 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: help on attributes - data step
Dear Listers,
I work with PIs who like to do their own statistical analysis, so
offten
request the data with each variable being formatted and labeled. Now I
am
having trouble to incorporate the formats into data by using the ATTRIB
statement in data step, have been struggled for a while and really need
help.
Here is my simplified code and I don't know why it just won't work.
I have a seperate program called fmt05.sas like this:
PROC FORMAT LIBRARY = a.myfmt;
VALUE DPSEXF
1 = 'MALE '
2 = 'FEMALE'
7 = 'REFUSED'
8 = 'DK'
;
....
RUN;
(I know all the formats have been created and saved in library by using
contlout=, I also added option fmtsearch = a;)
Then I have a seperate program called attrib.sas like this:
ATTRIB DPSEX FORMAT=DPSEXF. LABEL= '<DPSEX> PATIENT'S GENDER';
ATTRIB DPAGE LABEL = '<DPAGE> PATIENT'S AGE';
My main program look like this:
data want;
set have;
%include 'c:\myprogram\attrib.sas';
run;
Then I get message in log file says:
+ ATTRIB DPSEX FORMAT=DPSEXF. LABEL= '<DPSEX> PATIENT'S GENDER';
---------
48
ERROR 48-59: The format DPSEXF was not found or could not be loaded.
What could be wrong?
Many thanks in advance.