From: Jack Hamilton on
And the example provided by Wensui creates a character variable with the default length of 8, so TEXT has a value of "12345678", not "1234567890".


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


On Jan 1, 2010, at 8:02 pm, Joe Matise wrote:

> I know that. Reread my post, the bit after the second sentence. SAS has
> ways of approaching this, but does not [for, I believe, the reason I stated]
> simply allow undefined length character.
>
> -Joe
>
> On Fri, Jan 1, 2010 at 9:46 PM, 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
>> ==============================
>>
From: Sigurd Hermansen on
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
==============================
From: Jack Hamilton on
Interesting. I thought it would require

create table test(text varchar(50));

but either form will work.

I don't think it's a generic solution, though, just a different specific solution. I don't think there's a way to create a character variable of the minimum required length for a set of data without either the programmer or a program calculating that length.






On Jan 1, 2010, at 9:45 pm, Sigurd Hermansen 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
> ==============================




--
Jack Hamilton
jfh(a)alumni.stanford.org
Suave, mare magno turbantibus aequora ventis, et terra magnum alterius spectare laborem.
From: Jack Hamilton on
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
> ==============================
From: Wensui Liu on
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
==============================