Re: does sas support varchar data type?

  • Follow


VARCHAR is a SQL data type.  SAS has character variables, just not called
VARCHAR.  If you're noting that SAS doesn't have variable length characters,
look at COMPRESS dataset/system option; make your characters long enough,
and then COMPRESS will make the space that wasn't being used go away.  SAS
doesn't natively do this, presumably for reasons of simplicity of storage
[knowing how big each row is ahead of time allows it to specify how much
storage space to use].

-Joe

On Fri, Jan 1, 2010 at 9:31 PM, Wensui Liu <liuwensui@gmail.com> wrote:

> i couldn't find any evidence that sas/base supports varchar data type.
> a little surprise though.
> any insight or experience?
>
> thank you so much and have a happy 2010!
>
0
Reply snoopy369 (1752) 1/2/2010 3:40:34 AM

On Jan 1, 8:40=A0pm, snoopy...@GMAIL.COM (Joe Matise) wrote:
> VARCHAR is a SQL data type. =A0SAS has character variables, just not call=
ed
> VARCHAR. =A0If you're noting that SAS doesn't have variable length charac=
ters,
> look at COMPRESS dataset/system option; make your characters long enough,
> and then COMPRESS will make the space that wasn't being used go away. =A0=
SAS
> doesn't natively do this, presumably for reasons of simplicity of storage
> [knowing how big each row is ahead of time allows it to specify how much
> storage space to use].
>
> -Joe
>
>
>
> On Fri, Jan 1, 2010 at 9:31 PM, Wensui Liu <liuwen...@gmail.com> wrote:
> > i couldn't find any evidence that sas/base supports varchar data type.
> > a little surprise though.
> > any insight or experience?
>
> > thank you so much and have a happy 2010!- Hide quoted text -
>
> - Show quoted text -

Joe,

When a variable length field is defined, it requires metadata be
stored at the record level vs the dataset level. Otherwise, there is
no easy way to know where 1 field starts and another ends. A fixed
length record (and fields) allows the metadata to be held once. When
dealing with an obs that is very large (lots of vars), the amount of
metadata per record can increase to a very large size reducing any
efficiency found by compressing space. Hence, compression can cost
more in lots of ways.

SAS doesn't, by default, support compression, IMO, because it is far
less efficient in most situations.

Let me know if I missed something.

Alan
http://www.savian.net

0
Reply Savian 1/3/2010 6:10:46 AM


It's simple -

Varchar is supported through SQL
It will be apply the same to SAS, Teradata, etc.
When applied to a SAS dataset it simply converts to CHAR.

Regardless of any other RDBMS in pay, the max length will be 32768 if
you are on Windows SAS.
If your SAS programs run on multiple OS - use the VARCHAR declaration
through SQL instead of Data Step.




0
Reply montura 1/4/2010 2:27:31 PM

2 Replies
413 Views

(page loaded in 0.047 seconds)

Similiar Articles:













7/26/2012 11:28:08 PM


Reply: