I have a small Q//
how can i change the length of a num column..
i'm unable to change it using alter modify .. since its a num.. can
any1 solve my prob??
ex-
proc sql;
create table dept(deptno num(20), dname char(30), loc varchar(33));
quit;
in the above ex. i have created deptno with length 20..
if i try 2 change it using alter modify.. it doesnt change.. can i
know how to modify the length??
|
|
0
|
|
|
|
Reply
|
car612 (1)
|
1/16/2011 4:59:19 AM |
|
On Jan 16, 12:59=A0pm, Car <car...@gmail.com> wrote:
> I have a small Q//
>
> how can i change the length of a num column..
> i'm unable to change it using alter modify .. since its a num.. can
> any1 solve my prob??
>
> ex-
> proc sql;
> create table dept(deptno num(20), dname char(30), loc varchar(33));
> quit;
>
> in the above ex. i have created deptno with length 20..
> if i try 2 change it using alter modify.. it doesnt change.. can i
> know how to modify the length??
Just a test..
|
|
0
|
|
|
|
Reply
|
Yuewei
|
1/16/2011 2:50:33 PM
|
|
On Jan 15, 8:59=A0pm, Car <car...@gmail.com> wrote:
> I have a small Q//
>
> how can i change the length of a num column..
> i'm unable to change it using alter modify .. since its a num.. can
> any1 solve my prob??
>
> ex-
> proc sql;
> create table dept(deptno num(20), dname char(30), loc varchar(33));
> quit;
>
> in the above ex. i have created deptno with length 20..
> if i try 2 change it using alter modify.. it doesnt change.. can i
> know how to modify the length??
Does the following work?
data want;
length deptno 2.;
set have;
run;
|
|
0
|
|
|
|
Reply
|
Reeza
|
1/16/2011 10:27:53 PM
|
|
"Car" <car612@gmail.com> wrote in message
news:210451b4-8e3f-4f6b-acba-ed8f78b6a43e@q18g2000vbk.googlegroups.com...
> I have a small Q//
>
> how can i change the length of a num column..
> i'm unable to change it using alter modify .. since its a num.. can
> any1 solve my prob??
>
> ex-
> proc sql;
> create table dept(deptno num(20), dname char(30), loc varchar(33));
> quit;
>
>
> in the above ex. i have created deptno with length 20..
> if i try 2 change it using alter modify.. it doesnt change.. can i
> know how to modify the length??
You have NOT created any numeric variable with a length of 20 in SAS. SAS
does not support numeric variables with a length greater than 8.
Numeric variables in SAS have a default length of 8. On a Windows platform,
the largest integer that can be accurately stored is 9,007,199,254,750,992.
The number of significant digits retained is 15.
If you want to change the length of a numeric variable, you can make it
shorter - depending on the platform, numeric variables can be as short as 2
or 3 bytes. On Windows, the lower limit is 3, and the largest integer than
can be stored exactly in 3 bytes is 8,192. The number of significant digits
retained is 3.
Unless disk space is constrained for some reason, it's rarely beneficial to
change the length of a numeric variable - you save a few bytes of space, but
at the cost of accuracy. Unless you know for certain that the value of a
variable will never ever for any reason go above the accuracy limit for a
given length, you're risking undependable results. Changing the length of a
numeric variable affects only the space used to store the variables on disk.
Internally during processing, all numeric variables are expanded to 8 bytes.
What you can do is change the format of a variable - that is, you can change
how a variable is displayed. For instance, you can display a given variable
with format 3. (which will display up to 3 significant digits - if the
number is negative, one position is used to display a minus sign) or 5.
(which will display up to 5 significant digits) and so on up to the limit of
30. (which display up to 30 significant digits). Changing the format
changes the length displayed on the screen or on a printout, but it does not
change the length of the variable - that is, it does not change the amount
of memory used by a program or the amount of space used to store a SAS
dataset on disk.
|
|
0
|
|
|
|
Reply
|
Lou
|
1/17/2011 12:58:13 AM
|
|
|
3 Replies
286 Views
(page loaded in 0.092 seconds)
|