| Date: | Mon, 5 Mar 2001 09:31:32 -0500 |
| Reply-To: | Sigurd Hermansen <HERMANS1@WESTAT.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Sigurd Hermansen <HERMANS1@WESTAT.COM> |
| Subject: | Re: how can I change the maximum length of a variable ? |
|
| Content-Type: | text/plain; charset="iso-8859-1" |
First let me assure you that your English is better than my French! Also,
although Charles Patridge has already posted a workable solution, you are
asking an interesting question.
If I had not seen the eight-character maximum for default string input, I
would not have guessed a default value of eight. Why eight? I have no
idea, other than perhaps a case of forced consistency between the default
lengths of character and numeric data types in SAS.
Except for the odd default value, the basic string INPUT statement does a
remarkably good job of parsing a data stream. It sets a default of
"delimiter=blank" as well as "length xxxx $ 8" for each character variable.
The program,
data table;
/* length prenom $ 8 nom $ 8 ; */
/* infile cards delimiter=blank; */
input prenom $ nom $ ;
cards;
f beret
robert delataillande
feuxfrançois beretti
robert deladeladeladelataillande
;
run;
comments out the defaults. You should understand them nonetheless. Try
changing the LENGTH's to 20 and 50 and removing the comment escape
operators. With that change your program works as expected. (Viola!???).
It usually makes sense to specify variable lengths and delimiters and not
leave the choices to the data step compiler. Compilers don't understand the
context of your program. Sig
-----Original Message-----
From: u140563964@SPAWNKILL.IP-MOBILPHONE.NET
[mailto:u140563964@SPAWNKILL.IP-MOBILPHONE.NET]
Sent: Sunday, March 04, 2001 2:29 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: how can I change the maximum length of a variable ?
hello
first I have to warn you that I am french (so I can't speak english
very well). Moreover I'm a beginner so excuse me for my question
(which must be easy for you).
I use SAS system release 8.01
I would like to know how to have a text variable with a length of
more than eight characters.
My example is :
----------
data table;
input prenom $ nom $;
cards;
françois beretti
robert delataillande;
run;
proc print;
run;
----------
this prints :
Obs prenom nom
1 françois beretti
2 robert delatail
so the string "delataillande" is changed in "delatail", and I don't
want it.
I would also like to know what are the "format", "informat" and "length"
keywords (in the definition of a variable) used for and
how they are used.
Can anyone help me ?
Thanks in advance
François
--
Sent by fberetti from ireste within area fr
This is a spam protected message. Please answer with reference header.
Posted via http://www.usenet-replayer.com/cgi/content/new
|