Hi,
I have an variable called "SUPPORT_CUST_NAME". It is defined as "Char" type with leng of 100. it is labled as "SupportCustName".
Dataset name is "ELT.ELT_SEC_SUPPORT_BY".
The problem is that the value of "SUPPORT_CUST_NAME" seems chopped much less than 100. Many names are chopped. I need to find the longest value to confirm my finding?
How do I find out the longest length of value for "SUPPORT_CUST_NAME" with its primay key "CR_APPL_NO"?
Please help with SAS code!
Thanks!
Nancy
proc sql;
select max(length(SUPPORT_CUST_NAME))
from ELTElend.ELT_SEC_SUPPORT_BY
;
quit;
Before you examine the lengths, the first step would be to examine the format. If a variable is defined as $100 but has a format of $50., you will only see the first 50 characters.
How to write the code to find out?
Here is my code to look at the table:
data elendSUPPORTBY;
set ELTElend.ELT_SEC_SUPPORT_BY;
Title "Support by in ELT ELEND";
proc print data= elendSUPPORTBY;
run;
Thanks!
proc sql;
select max(length(SUPPORT_CUST_NAME))
from ELTElend.ELT_SEC_SUPPORT_BY
;
quit;
Hi SASKiwi,
Thank you so much for the SAS SQL query! The SAS query works very well.
Does the embedded sql query follow standard SQL syntax? Do they follow Oracle or DB2 or Microsoft standard?
Thanks!
Nancy
SAS SQL doesn't necessarily follow ANSI SQL standards. Most basic queries such as the one here, can be used in both Oracle and SQL.
SAS FEDSQL is ANSI standard.
Oracle SQL is different than Microsoft SQL.
You can use SQL pass through if you want to pass a query directly to your server.
The easiest way to find out formats would be:
proc contents data=eltelend.elt_sec_support_by;
run;
Hi Astounding,
Thank you for your suggestion. Yes. I have tried proc contents, that is how I get to know this variable SUPPORT_CUST_NAME is char type with length of 100. But somehow only display 40 chars.
It may due to an error in ETL process.
Thank you so mcuh for help!
Nancy
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: