Date: Wed, 11 Aug 2004 10:58:18 -0700
Reply-To: "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject: Re: Implicit format type conversion in SAS?
Mike-
When I try other numeric formats SAS tries to append a "$" to the format,
this must be default, so the 8. apparently becomes $8.
70 DATA _NULL_;
71 LENGTH Var Newvar $ 24;
72 Var = '12345678901234567890';
73 Newvar = PUT(Var,yymmdd8.);
--------
48
ERROR 48-59: The format $YYMMDD was not found or could not be loaded.
74 put _all_;
75
76 RUN;
NOTE: The SAS System stopped processing this step because of errors.
77 DATA _NULL_;
78 LENGTH Var Newvar $ 24;
79 Var = '12345678901234567890';
80 Newvar = PUT(Var,dollar8.);
--------
48
ERROR 48-59: The format $DOLLAR was not found or could not be loaded.
81 put _all_;
82
83 RUN;
NOTE: The SAS System stopped processing this step because of errors.
Regards
Paul Choate
DDS Data Extraction
(916) 654-2160
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Mike
Rhoads
Sent: Wednesday, August 11, 2004 10:44 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Implicit format type conversion in SAS?
Has anyone ever tried something like the following?
DATA _NULL_;
LENGTH Var Newvar $ 24;
Var = 'This is very strange.';
Newvar = PUT(Var,8.);
PUT 'First 12 chars of Var are ' Var 12.;
PUT 'Value if Newvar is ' Newvar;
RUN;
Much to my surprise, the above code works. (SAS 8.2, WinXP) When I was
much, much younger and I learned SAS on my momma's knee, she always taught
me that character formats started with $, that numeric formats didn't, and
that the format type always had to be consistent with the variable type.
I'm not sure whether this works by accident, whether it works because SAS is
being "smart" and "helpful", or whether there is some other simple
explanation I'm missing.
Mike Rhoads
Westat
RhoadsM1@Westat.com