Date: Tue, 24 Jul 2007 09:17:50 +1000
Reply-To: d@dkvj.biz
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David Johnson <d@DKVJ.BIZ>
Subject: Re: help sample
In-Reply-To: <07123CDF07D82249A6A840A789BC2EEE03B305C4@sges0004.essilor.com.sg>
Content-Type: text/plain; charset="iso-8859-1"
The way people use SAS is often changed by the way they regularly interact
with the program. For the person who runs code in a handful of steps and
browses data, there may not be much reason to be concerned over some notes
that appear in the SAS log. After all, each step is being checked in the
interactive process of writing and running SAS code. At least that is a
view held by some people.
On the other hand, you have people who write processes that may run
unattended, or be rerun a number of times to refine a report, or report data
regularly. For the people in that group, every note in the log is
important, and anything outside the expected data set sizing and run time is
a matter for concern. Or at least, it should be, since some of those notes
will affect the data that is delivered.
I pre-empt my remarks with that Vora because I am trying not to make any
comments about "right" and "wrong" ways to write code. However, I think
there is a flaw in your suggestion that could cause you grief and I will
suggest you consider whether that is important to you.
The flaw is that data type conversions are easily done by SAS to clean up
after small oversights in our coding, but if we know the type of our data,
then these should not appear. They are a symptom that we don't fully
understand what we are working with, and they add more "noise" to the log,
which in itself is also potentially a problem.
Knowing that data types will be converted, I would always perform the
conversion explicitly so that the message does not appear, and the data is
handled in the way I expect it to be handled, when it is of the type that I
expect it to be. Then, when a message appears, I know the data are not as I
expected, and I know I need to look further. Refining your solution, I
would code the JOINED line as follows:
JOINED = Put( A, Best.) || B;
Kind regards
David
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of VORA
Mihir
Sent: Monday, 23 July 2007 7:24 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: help sample
Hi,
Below is a sample code that you could use. Here I have tried to read "a" as
number. As SAS does implicit numeric to character conversion you would not
have to worry much. It will just put a note in the SAS log stating "Numeric
values have been converted to character values at the places given by ...".
If you read "a" as character then you would not face any problem.
/* reading two columns a and b, a as number and b as character */
data test;
input a b $;
datalines;
1 pub
2 pub
3 priv
4 priv
5 pub
6 pub
7 pub
8 priv
9 priv
10 priv
11 priv
12 priv
;
run;
/* joining them */
data join;
set test;
joined = a || b;
run;
HTH,
Mihir Vora
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
edna.biokou@GMAIL.COM
Sent: Monday, July 23, 2007 4:48 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: help sample
morning
i want join two column in my table sas.
example:
1 pub
2 pub
3 priv
4 priv
5 pub
6 pub
7 pub
8 priv
9 priv
10 priv
11 priv
12 priv
i will obtain a column like this:
1pub
2pub
3priv
4priv
5pub
6pub
7pub
8priv
9priv
10priv
11priv
12priv
thank for your help.