BookmarkSubscribeRSS Feed
LearnByMistk
Obsidian | Level 7

I was using proc sql  case when statement  on sas EG and similar code using sas access to teradata to convert char to int.

 

logic run on sas eg which give error as  2nd when conditon has different data type variable

 

so what i have 

when var_cd equal '0' then 0 

when var_cd equal ' ' then null

else (10- input(var_Cd,8.) end as my_var_val

 

Logic which worked in Teradata sas access 

 

,cast(

                case

                when var_Cd is null then null

                when var_Cd = '0' then null

                else 10 - cast(var_Cd as byteint)

                end as byteint)            as var_Cd

 

Could anyone please elaborate how this thing process via SAS access but not in sas EG  where i used simple 

libname td teradata(user=&user pwd=&pwd schema=my_Schema );

2 REPLIES 2
PGStats
Opal | Level 21

Read the warnings and error messages.

 

equal should be eq or =

null should be .

your parentheses should be balanced

 

 

 

PG
Reeza
Super User

Your first code is SAS code. 

 

Your second set of code is Teradata code, use SQL Pass Through - code is literally passed to Teradata server. 

 

When end using a libname connection in EG you need to use SAS code. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 831 views
  • 0 likes
  • 3 in conversation