BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ashna
Obsidian | Level 7

Hi all,

 

I have variable that gets Numeric value most of the time but in certain conditions it can have character value. So I assigned Character to the variable while reading in the data from input file. 

 

I used put function to this variable  before I load data into Teradata table it works perfectly if I don't have any character value....if I have any character value that it gives me error.

 

Let say variable called Customer_name

Customer_name

     3456

     5678

     9800

     New

while mapping data in before step of teradata loader I used Put function as follows 

 put(Customer_name, 12.) 

This put function works perfectly if I don't have New in column. If I have New the following error occurs.

 

ERROR: Numeric format F in PUT function requires a numeric argument....  ERROR: Numeric format F in PUT function requires a numeric argument....  ERROR: Numeric format F in PUT function requires a numeric argument.

 

If change put function to 

put(Customer_name, $12.)

it works perfect for along with New in column Customer_name but doesn't work without New in column.

 

Can some one help me with this

 

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

Try this:

cat(Customer_name)

Don't forget to set the length.

View solution in original post

5 REPLIES 5
ChrisNZ
Tourmaline | Level 20

Try this:

cat(Customer_name)

Don't forget to set the length.

LinusH
Tourmaline | Level 20
@ChrisNZ I think that OP wants to get rid of chars, not being able to store them...?
As your post title say, use case with lets say ANYALPHA() function, if FALSE then INPUT() to the numerical target, else set MISSING.
Data never sleeps
ashna
Obsidian | Level 7

I tried to implement your suggestion, 

 

case when anyalpha(customer_acct) then "." else customer_acct end

It works perfectly if I have New as value in customer_acct variable.

 

But if I don't have New as value in customer_acct variable it gives me following error

 

ERROR: Function ANYALPHA requires a character expression as argument 1....  ERROR: Result of WHEN clause 2 is not the same data type as the preceding results.

 

How to e-solve this?

LinusH
Tourmaline | Level 20
Take a look at the generated code for the whole step. I recall there's a weakness here where you can't change the data type for a column, even if you are using a SQL SELECT. Try to use a different name on the source or the target column.
Data never sleeps
ashna
Obsidian | Level 7

Thanks,

 

Used Cat function as suggested by @ChrisNZ. That worked.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1604 views
  • 0 likes
  • 3 in conversation