Date: Thu, 11 Mar 2004 07:22:53 -0500
Reply-To: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject: Re: Default values
You can set all numeric variables to 0 if they are missing with something
array a(*) _numeric_;
do i=1 to dim(a);
if a(i)=. then a(i)=0;
However there are no data-variables in SAS. In SAS dates are simple numeric
variables. So how you get them seperated from other numerics? Don't know!
With chars it's easy: they are already how you want them. In SAS a missing
char is a blank.
And: it's very dangerous, what you are doing! Normally there is a reason
for defining variables as "not null". E.g. imagine, you have a date
variable with birthdays. If you have "no information" about a birthday (of
your customer), it's a big difference to: "birthday is 1900/01/01", because
in the first case you better send no congratulations (because "you don't
know the date"), in the other you make him 104 years old!
On Thu, 11 Mar 2004 11:48:59 +0530, Nitin Chandak
>I am working on SAS and DB2 on mainframe.
>I am extracting data (only 3 columns) from one table of DB2 using libname
>statement and after manipulating them I want to insert
>values to another DB2 table through PROC SQL.
>The problem is, second table is having 20 columns in which few of them are
>defined. I am getting error while inserting null values in not null defined
>want to set default values for rest of the 17 columns.
>For number default value should be 0.
>For date default value should be '01/01/1900'.
>For character default value should be '' (Space).
>I don't want to write default value for each and every column in PROC SQL.
>handle this situation in SAS? There are more 150 tables in DB2.
>Stingray Technologies Pvt. Ltd.
>B-10, Sector 1, Udyog Marg,
>Noida-201 301 (NCR Delhi).
>Mobile : 09811431769