Hi there everyone,
I'm still new to the sas world and currently stuck trying to format a variable.
I have a proc sql step and I'm hitting a sequel table but the column I'm matching it with is not numeric. I'm wanting to format b.AccountNumber; to numeric but not sure what steps to take.
see below
proc sql; create table FTY1 as select
a. *
,b. ResponseCodeMessage
from FTY a left outer join COL.biz b on a.Account_number=b.AccountNumber;
quit;
I assume that b.AccountNumber is the one that is not numeric?
proc sql; create table FTY1 as select
a. *
,b. ResponseCodeMessage
from FTY a left outer join COL.biz b on a.Account_number=input(b.AccountNumber, best.);
quit;
I assume that b.AccountNumber is the one that is not numeric?
proc sql; create table FTY1 as select
a. *
,b. ResponseCodeMessage
from FTY a left outer join COL.biz b on a.Account_number=input(b.AccountNumber, best.);
quit;
that's correct - Thank you SOOOO much.
I will give it a try and let you know if it works.
Appreciate this alot.
Anytime, let me know if it works for you
Thank you so much Draycut - it worked appreciate the help again.
Have an awesome day!
Thanks for the answer ,useful to me.
q1: one col is numeric and one col is char. when comparing which is best ? char to numeric conversion or numeric to char ? please give some explanation,please.
It depends...
Don't you love that answer? But seriously, it does, and here are some of the considerations.
If you're SURE that your character column always contains number, and you can reliably convert them to numeric, then I would go with numeric, as it's not subject to odd formatting issues (does '5 ' equal '5'? does ' 5' equal '5'?)
If you're going to have issues (e.g. converting 'abc' to numeric), then you might want to go with character. It may be challenging to figure out how to convert your numeric value to character, SAS has lots of functions to help. (There's the subject for your next question!)
In either case, be cautious about numbers with fractions. They don't always convert nicely to the hexadecimal used by computers, and two numbers that look similar can actually be different.
My two cents worth!
Tom
thanks for reply.
I did not get answer for my question.
we can convert from numeric to character (or vice versa)
My intention is to know which conversion should be happened to get better performance?
(char to numer or numer to char)??
@rajeshm wrote:
we can convert from numeric to character (or vice versa)
My intention is to know which conversion should be happened to get better performance?
(char to numer or numer to char)??
What do you mean by "performance"?
I don't know, buy you can find the answer easily enough.
Create data sets where the variable of interest is numeric and a similar data set where the variable of interest is character.
Then compare by converting to character to numeric. Then compare by converting numeric to character. Which one runs faster?
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: