From: Sigurd Hermansen on
In theory VARCHAR and CHAR differ in the SQL table or expression that a SQL SELECT statement yields; when written to a SAS dataset, they would define the same result. The length specification in SAS SQL changes the default maximum length of a SAS variable from 8 to another number.

Note that the maximum length of a variable limits the length of any value subsequently inserted or updated into that variable. This anticipated maximum length typically has more importance than the maximum length of values in data used to create a SAS dataset initially. Setting the maximum length too low may lead to truncations.

Joe's suggested use of safe variable lengths and the COMPRESS option seems as close to RDBMS methods as anything that one could do in a SAS program. A bit less convenient, but effective for comments and the like when separated into special datasets linked to other datasets ....
S

-----Original Message-----
From: Wensui Liu [mailto:liuwensui(a)gmail.com]
Sent: Saturday, January 02, 2010 1:01 AM
To: Sigurd Hermansen
Cc: SAS-L(a)LISTSERV.UGA.EDU
Subject: Re: does sas support varchar data type?

in this case, then what's the difference between varchar and char?

On Sat, Jan 2, 2010 at 12:45 AM, Sigurd Hermansen <HERMANS1(a)westat.com> wrote:
> Wensui:
> Not to answer for Art, but try
> CREATE TABLE test(TEXT varchar 50);
>
> The length 50 could be set to a much larger value if required.
> S
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of Wensui Liu
> Sent: Friday, January 01, 2010 11:33 PM
> To: SAS-L(a)LISTSERV.UGA.EDU
> Subject: Re: does sas support varchar data type?
>
> as always, thank you so much, art!
> see the following code. is there a generic way to read the full string
> into table without specify the length?
>
> proc sql;
> CREATE TABLE test(TEXT varchar);
> insert into test values ('1234567890');
> quit;
>
> On Fri, Jan 1, 2010 at 11:20 PM, Arthur Tabachneck <art297(a)netscape.net> wrote:
>> Wensui,
>>
>> Take a look at:
>> http://books.google.ca/books?
>> id=uZYn6unDVtoC&pg=PT688&lpg=PT688&dq=sas+equivalent+varchar&source=bl&ots=r
>> 0a99KO47m&sig=6o_TIGSeiCe5-YdGy5-qnAcKqsw&hl=en&ei=lcg-
>> S6vdLszJlAfJu8yjBw&sa=X&oi=book_result&ct=result&resnum=2&ved=0CA4Q6AEwAQ#v=
>> onepage&q=sas%20equivalent%20varchar&f=false
>>
>> or, in short form: http://xrl.us/bgrsyh
>>
>> Art
>> -------
>> On Fri, 1 Jan 2010 22:46:44 -0500, Wensui Liu <liuwensui(a)GMAIL.COM> wrote:
>>
>>>joe
>>>varchar is character data type of indeterminate length. try this
>>>proc sql;
>>>create table test(TEXT varchar);
>>>insert into test values('1234567890');
>>>quit;
>>>
>>>
>>>On Fri, Jan 1, 2010 at 10:40 PM, Joe Matise <snoopy369(a)gmail.com> wrote:
>>>> 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(a)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!
>>>>
>>>>
>>>
>>>
>>>
>>>--
>>>==============================
>>>WenSui Liu
>>>Blog : statcompute.spaces.live.com
>>>Tough Times Never Last. But Tough People Do. - Robert Schuller
>>>==============================
>>
>
>
>
> --
> ==============================
> WenSui Liu
> Blog : statcompute.spaces.live.com
> Tough Times Never Last. But Tough People Do. - Robert Schuller
> ==============================
>



--
==============================
WenSui Liu
Blog : statcompute.spaces.live.com
Tough Times Never Last. But Tough People Do. - Robert Schuller
==============================
From: Jack Hamilton on
OK, but that doesn't have any effect on base SAS data set types.

You seem to be quoting from <http://www.sfu.ca/sasdoc/sashtml/accdb/z1127961.htm>, which is the only match Google finds. In this context, "Matching Teradata Data Types to More Efficient SAS Formats" (copyright 1999), the words CHAR and VARCHAR seem to be referring to Teradata data types, not to SAS data types.

The section in which the quote occurs seems to have been dropped from the 9.1.3 documentation (copyright 2007), <http://support.sas.com/onlinedoc/913/getDoc/en/acreldb.hlp/a001384456.htm>.

The SAS documentation doesn't seem to draw a distinction between SAS data types and SAS data formats, which is unfortunate, but it does say that the $, $CHAR, and $VARYING formats all convert to the CHAR data type in Teradata, <http://support.sas.com/onlinedoc/913/getDoc/en/acreldb.hlp/a001384390.htm>.


--
Jack Hamilton
jfh(a)alumni.stanford.org
Suave, mare magno turbantibus aequora ventis, et terra magnum alterius spectare laborem.



On Jan 2, 2010, at 9:30 am, Arthur Tabachneck wrote:

> Joe,
>
> It came in when I first responded to Wensui. The 'varchar' reference I
> quoted, and my original link, was from the documentation for the SAS/Access
> product for Teradata.
>
> Art
> -------
> On Sat, 2 Jan 2010 11:23:49 -0600, Joe Matise <snoopy369(a)GMAIL.COM> wrote:
>
>> I'm a bit confused [or perhaps only partially awake]. When did teradata
>> come into this?
>>
>> -Joe
>>
>> On Sat, Jan 2, 2010 at 11:21 AM, Arthur Tabachneck
> <art297(a)netscape.net>wrote:
>>
>>> Wensui,
>>>
>>> If the documentation is correct then I don't think that the answer is
>>> "none." It states:
>>>
>>> "Where possible define CHAR columns in place of VARCHAR and LONG
>>> VARCHAR character Teradata columns. These data type changes can speed up
>>> processing. But, only when you read the data using SAS/ACCESS. Therefore,
>>> create anew table only if you intend to access the table primarily
> through
>>> SAS/ACCESS.
>>>
>>> Art
>>> -------
>>> On Sat, 2 Jan 2010 01:22:51 -0500, Wensui Liu <liuwensui(a)GMAIL.COM>
> wrote:
>>>
>>>> this is exactly what i thought.
>>>> thanks, jack!
>>>>
>>>> On Sat, Jan 2, 2010 at 1:18 AM, Jack Hamilton <jfh(a)alumni.stanford.org>
>>> wrote:
>>>>> On Jan 1, 2010, at 10:01 pm, Wensui Liu wrote:
>>>>>
>>>>>> in this case, then what's the difference between varchar and char?
>>>>>
>>>>> None. They are synonyms in data sets created using the base SAS
> engine.
>>>>>
>>>>>
>>> http://support.sas.com/onlinedoc/913/getDoc/en/proc.hlp/a002473683.htm
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Jack Hamilton
>>>>> jfh(a)alumni.stanford.org
>>>>> Caelum non animum mutant qui trans mare currunt.
>>>>>
>>>>> On Jan 1, 2010, at 10:01 pm, Wensui Liu wrote:
>>>>>
>>>>>> in this case, then what's the difference between varchar and char?
>>>>>>
>>>>>> On Sat, Jan 2, 2010 at 12:45 AM, Sigurd Hermansen
> <HERMANS1(a)westat.com
>>>>
>>> wrote:
>>>>>>> Wensui:
>>>>>>> Not to answer for Art, but try
>>>>>>> CREATE TABLE test(TEXT varchar 50);
>>>>>>>
>>>>>>> The length 50 could be set to a much larger value if required.
>>>>>>> S
>>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of
>>> Wensui Liu
>>>>>>> Sent: Friday, January 01, 2010 11:33 PM
>>>>>>> To: SAS-L(a)LISTSERV.UGA.EDU
>>>>>>> Subject: Re: does sas support varchar data type?
>>>>>>>
>>>>>>> as always, thank you so much, art!
>>>>>>> see the following code. is there a generic way to read the full
> string
>>>>>>> into table without specify the length?
>>>>>>>
>>>>>>> proc sql;
>>>>>>> CREATE TABLE test(TEXT varchar);
>>>>>>> insert into test values ('1234567890');
>>>>>>> quit;
>>>>>>>
>>>>>>> On Fri, Jan 1, 2010 at 11:20 PM, Arthur Tabachneck
>>> <art297(a)netscape.net> wrote:
>>>>>>>> Wensui,
>>>>>>>>
>>>>>>>> Take a look at:
>>>>>>>> http://books.google.ca/books?
>>>>>>>>
>>>
>>>
> id=uZYn6unDVtoC&pg=PT688&lpg=PT688&dq=sas+equivalent+varchar&source=bl&ots=r
>>>>>>>> 0a99KO47m&sig=6o_TIGSeiCe5-YdGy5-qnAcKqsw&hl=en&ei=lcg-
>>>>>>>>
>>>
>>>
> S6vdLszJlAfJu8yjBw&sa=X&oi=book_result&ct=result&resnum=2&ved=0CA4Q6AEwAQ#v=
>>>>>>>> onepage&q=sas%20equivalent%20varchar&f=false
>>>>>>>>
>>>>>>>> or, in short form: http://xrl.us/bgrsyh
>>>>>>>>
>>>>>>>> Art
>>>>>>>> -------
>>>>>>>> On Fri, 1 Jan 2010 22:46:44 -0500, Wensui Liu <liuwensui(a)GMAIL.COM>
>>> wrote:
>>>>>>>>
>>>>>>>>> joe
>>>>>>>>> varchar is character data type of indeterminate length. try this
>>>>>>>>> proc sql;
>>>>>>>>> create table test(TEXT varchar);
>>>>>>>>> insert into test values('1234567890');
>>>>>>>>> quit;
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Fri, Jan 1, 2010 at 10:40 PM, Joe Matise <snoopy369(a)gmail.com>
>>> wrote:
>>>>>>>>>> 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(a)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!
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> ==============================
>>>>>>>>> WenSui Liu
>>>>>>>>> Blog : statcompute.spaces.live.com
>>>>>>>>> Tough Times Never Last. But Tough People Do. - Robert Schuller
>>>>>>>>> ==============================
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> ==============================
>>>>>>> WenSui Liu
>>>>>>> Blog : statcompute.spaces.live.com
>>>>>>> Tough Times Never Last. But Tough People Do. - Robert Schuller
>>>>>>> ==============================
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> ==============================
>>>>>> WenSui Liu
>>>>>> Blog : statcompute.spaces.live.com
>>>>>> Tough Times Never Last. But Tough People Do. - Robert Schuller
>>>>>> ==============================
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> ==============================
>>>> WenSui Liu
>>>> Blog : statcompute.spaces.live.com
>>>> Tough Times Never Last. But Tough People Do. - Robert Schuller
>>>> ==============================
>>>
From: Wensui Liu on
thanks for your comments, Sig
"safe variable lengths" in your reply is a very arbitrary term :-)


On Sat, Jan 2, 2010 at 1:21 PM, Sigurd Hermansen <HERMANS1(a)westat.com> wrote:
> In theory VARCHAR and CHAR differ in the SQL table or expression that a SQL SELECT statement yields; when written to a SAS dataset, they would define the same result. The length specification in SAS SQL changes the default maximum length of a SAS variable from 8 to another number.
>
> Note that the maximum length of a variable limits the length of any value subsequently inserted or updated into that variable. This anticipated maximum length typically has more importance than the maximum length of values in data used to create a SAS dataset initially. Setting the maximum length too low may lead to truncations.
>
> Joe's suggested use of safe variable lengths and the COMPRESS option seems as close to RDBMS methods as anything that one could do in a SAS program. A bit less convenient, but effective for comments and the like when separated into special datasets linked to other datasets ....
> S
>
> -----Original Message-----
> From: Wensui Liu [mailto:liuwensui(a)gmail.com]
> Sent: Saturday, January 02, 2010 1:01 AM
> To: Sigurd Hermansen
> Cc: SAS-L(a)LISTSERV.UGA.EDU
> Subject: Re: does sas support varchar data type?
>
> in this case, then what's the difference between varchar and char?
>
> On Sat, Jan 2, 2010 at 12:45 AM, Sigurd Hermansen <HERMANS1(a)westat.com> wrote:
>> Wensui:
>> Not to answer for Art, but try
>> CREATE TABLE test(TEXT varchar 50);
>>
>> The length 50 could be set to a much larger value if required.
>> S
>>
>> -----Original Message-----
>> From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of Wensui Liu
>> Sent: Friday, January 01, 2010 11:33 PM
>> To: SAS-L(a)LISTSERV.UGA.EDU
>> Subject: Re: does sas support varchar data type?
>>
>> as always, thank you so much, art!
>> see the following code. is there a generic way to read the full string
>> into table without specify the length?
>>
>> proc sql;
>> CREATE TABLE test(TEXT varchar);
>> insert into test values ('1234567890');
>> quit;
>>
>> On Fri, Jan 1, 2010 at 11:20 PM, Arthur Tabachneck <art297(a)netscape.net> wrote:
>>> Wensui,
>>>
>>> Take a look at:
>>> http://books.google.ca/books?
>>> id=uZYn6unDVtoC&pg=PT688&lpg=PT688&dq=sas+equivalent+varchar&source=bl&ots=r
>>> 0a99KO47m&sig=6o_TIGSeiCe5-YdGy5-qnAcKqsw&hl=en&ei=lcg-
>>> S6vdLszJlAfJu8yjBw&sa=X&oi=book_result&ct=result&resnum=2&ved=0CA4Q6AEwAQ#v=
>>> onepage&q=sas%20equivalent%20varchar&f=false
>>>
>>> or, in short form: http://xrl.us/bgrsyh
>>>
>>> Art
>>> -------
>>> On Fri, 1 Jan 2010 22:46:44 -0500, Wensui Liu <liuwensui(a)GMAIL.COM> wrote:
>>>
>>>>joe
>>>>varchar is character data type of indeterminate length. try this
>>>>proc sql;
>>>>create table test(TEXT varchar);
>>>>insert into test values('1234567890');
>>>>quit;
>>>>
>>>>
>>>>On Fri, Jan 1, 2010 at 10:40 PM, Joe Matise <snoopy369(a)gmail.com> wrote:
>>>>> 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(a)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!
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>--
>>>>==============================
>>>>WenSui Liu
>>>>Blog : statcompute.spaces.live.com
>>>>Tough Times Never Last. But Tough People Do. - Robert Schuller
>>>>==============================
>>>
>>
>>
>>
>> --
>> ==============================
>> WenSui Liu
>> Blog : statcompute.spaces.live.com
>> Tough Times Never Last. But Tough People Do. - Robert Schuller
>> ==============================
>>
>
>
>
> --
> ==============================
> WenSui Liu
> Blog : statcompute.spaces.live.com
> Tough Times Never Last. But Tough People Do. - Robert Schuller
> ==============================
>



--
==============================
WenSui Liu
Blog : statcompute.spaces.live.com
Tough Times Never Last. But Tough People Do. - Robert Schuller
==============================
From: xlr82sas on
On Jan 2, 10:21 am, HERMA...(a)WESTAT.COM (Sigurd Hermansen) wrote:
> In theory VARCHAR and CHAR differ in the SQL table or expression that a SQL SELECT statement yields; when written to a SAS dataset, they would define the same result. The length specification in SAS SQL changes the default maximum length of a SAS variable from 8 to another number.
>
> Note that the maximum length of a variable limits the length of any value subsequently inserted or updated into that variable. This anticipated maximum length typically has more importance than the maximum length of values in data used to create a SAS dataset initially. Setting the maximum length too low may lead to truncations.
>
> Joe's suggested use of safe variable lengths and the COMPRESS option seems as close to RDBMS methods as anything that one could do in a SAS program. A bit less convenient, but effective for comments and the like when separated into special datasets linked to other datasets ....
> S
>
>
>
> -----Original Message-----
> From: Wensui Liu [mailto:liuwen...(a)gmail.com]
> Sent: Saturday, January 02, 2010 1:01 AM
> To: Sigurd Hermansen
>
> Cc: SA...(a)LISTSERV.UGA.EDU
> Subject: Re: does sas support varchar data type?
>
> in this case, then what's the difference between varchar and char?
>
> On Sat, Jan 2, 2010 at 12:45 AM, Sigurd Hermansen <HERMA...(a)westat.com> wrote:
> > Wensui:
> > Not to answer for Art, but try
> > CREATE TABLE test(TEXT varchar 50);
>
> > The length 50 could be set to a much larger value if required.
> > S
>
> > -----Original Message-----
> > From: SAS(r) Discussion [mailto:SA...(a)LISTSERV.UGA.EDU] On Behalf Of Wensui Liu
> > Sent: Friday, January 01, 2010 11:33 PM
> > To: SA...(a)LISTSERV.UGA.EDU
> > Subject: Re: does sas support varchar data type?
>
> > as always, thank you so much, art!
> > see the following code. is there a generic way to read the full string
> > into table without specify the length?
>
> > proc sql;
> > CREATE TABLE test(TEXT varchar);
> > insert into test values ('1234567890');
> > quit;
>
> > On Fri, Jan 1, 2010 at 11:20 PM, Arthur Tabachneck <art...(a)netscape.net> wrote:
> >> Wensui,
>
> >> Take a look at:
> >>http://books.google.ca/books?
> >> id=uZYn6unDVtoC&pg=PT688&lpg=PT688&dq=sas+equivalent+varchar&source=bl&ots=­r
> >> 0a99KO47m&sig=6o_TIGSeiCe5-YdGy5-qnAcKqsw&hl=en&ei=lcg-
> >> S6vdLszJlAfJu8yjBw&sa=X&oi=book_result&ct=result&resnum=2&ved=0CA4Q6AEwAQ#v­=
> >> onepage&q=sas%20equivalent%20varchar&f=false
>
> >> or, in short form:http://xrl.us/bgrsyh
>
> >> Art
> >> -------
> >> On Fri, 1 Jan 2010 22:46:44 -0500, Wensui Liu <liuwen...(a)GMAIL.COM> wrote:
>
> >>>joe
> >>>varchar is character data type of indeterminate length. try this
> >>>proc sql;
> >>>create table test(TEXT varchar);
> >>>insert into test values('1234567890');
> >>>quit;
>
> >>>On Fri, Jan 1, 2010 at 10:40 PM, Joe Matise <snoopy...(a)gmail.com> wrote:
> >>>> 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 <liuwen...(a)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!
>
> >>>--
> >>>==============================
> >>>WenSui Liu
> >>>Blog   : statcompute.spaces.live.com
> >>>Tough Times Never Last. But Tough People Do.  - Robert Schuller
> >>>==============================
>
> > --
> > ==============================
> > WenSui Liu
> > Blog   : statcompute.spaces.live.com
> > Tough Times Never Last. But Tough People Do.  - Robert Schuller
> > ==============================
>
> --
> ==============================
> WenSui Liu
> Blog   : statcompute.spaces.live.com
> Tough Times Never Last. But Tough People Do.  - Robert Schuller
> ==============================- Hide quoted text -
>
> - Show quoted text -


A little off topic

SAS uses compression effectively to save storage. In fact it can
outperform non
compressed varchar in some situations consider the almost 85%
compression of numeric variables and
97% compression of character data.

40619 data Bit(compress=binary);
40620 retain x1-x10000 0;
40621 drop Idx Jdx;
40622 array Wyd[*] X1-X10000;
40623 do Idx=1 to 2;
40624 do Jdx=1 to 10000;
40625 Wyd[Jdx]=mod(Jdx,2);
40626 output;
40627 end;
40628 end;
40629 run;

NOTE: The data set WORK.BIT has 20000 observations and 10000
variables.
NOTE: Compressing data set WORK.BIT decreased size by 84.71 percent.
Compressed is 3059 pages; un-compressed would require 20011
pages.
NOTE: DATA statement used (Total process time):
real time 14.45 seconds
cpu time 4.67 seconds


I think SAS uses multiple byte compression for character data

40757 data Chr(compress=char reuse=yes);
40758 drop Idx Jdx;
40759 array Wyd[*] $3000 X1-X1000;
40760 do Idx=1 to 30;
40761 do Jdx=1 to 1000;
40762 Wyd[Jdx]=repeat('A',2999);
40763 end;
40764 output;
40765 end;
40766 run;

NOTE: The data set WORK.CHR has 30 observations and 1000 variables.
NOTE: Compressing data set WORK.CHR decreased size by 96.67 percent.
Compressed is 1 pages; un-compressed would require 30 pages.
NOTE: DATA statement used (Total process time):
real time 0.32 seconds
cpu time 0.24 seconds


From: Savian on
On Jan 1, 8:40 pm, snoopy...(a)GMAIL.COM (Joe Matise) wrote:
> 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 <liuwen...(a)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