Date: Wed, 10 May 2006 09:32:39 -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: What is Logic here
Content-Type: text/plain; charset="us-ascii"
For ease of use probably - if the data aren't large then it may be a
reasonable thing to. We have 100 questions on a form that are likert
0-4 values but also may take Y, A, and N values. We keep them stored in
both forms so we don't need to convert the character data to operate on
the numeric portion of it. It's not a great design, but it is useful.
That said, note that the number 1 takes eight bytes to store, the
character '1' takes one byte. The disk space implications are enormous.
You can store digits in fewer bytes, but risk precision problems.
Generally categorical data, numeric or not, should be stored as
character.
SAS even implicitly converts character to numeric (with warning) so you
can store data as such.
Data Alpha;
input a $ b $;
c=a+b;
d=sum(a,b);
put (_all_)(=);
datalines;
1 2
3 4
5 x
7 8
;
run;
Note that 'c' and 'd' come out numeric, and the sum function does not
produce a missing value.
hth
Paul Choate
DDS Data Extraction
(916) 654-2160
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> proccontents@gmail.com
> Sent: Wednesday, May 10, 2006 8:40 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: What is Logic here
>
> Hello SAS-L's
>
> I have seen lot of times that people store the some variables in both
> types(char and num ) like dates, visit's etc. Is there any particular
> reason for doing this, I am right now working in a clinical envir .
> Thanks for the detailed explanation
|