BookmarkSubscribeRSS Feed
DEBE
Calcite | Level 5

Hello,

i am getting this error if i do for example a substr(xx,1,4) AS xx2.

I implemented the code in a prompt associated with an EG programm file, and it doenst work with BIGINT, table gets not created...but it does work on an other colum(VARCHAR), with the same error.

 

The BIGINT column code works on a same generated prompt in a stored process and the log doenst show me the error (didnt tested if the VARCHAR works, but i assume it works too).

 

So im a bit confused?! How to clean the errors on the normal EG project programm and get this work with the BIGINT column?

 

I tried it with %sysfunc(%quote(substr(xx,1,4) AS xx2)) but that doesnt work.

 

Just to understand, i put the whole substr(xx,1,4) AS xx2 in the prompt (unformated value), its in a static list and then i chose the value(formated displayed value) and take the function behind it, in this case the substr...

This works in a stored process with a simple prompt, but not 100% in a normal SAS EG promp associated with a program.

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Stored processes and EG Prompts are two very different things.  EG prompts are (as far as I can remember) only there to create macro variables with some data as chosen by the user, so putting code in there is not really going to work - nor is it a very good idea in the best of cases as it could seriously impact the integrity of your system (its called SQL injection).

DEBE
Calcite | Level 5
It works..because the code is the "data" that gets chosen.

SQL injection on a server from outside, ok nothing new...but why or how could something like a substr or something else could impact on a system?
Its just a written query, what the difference between this type of query or put that hardcoded in a sas program?
Tom
Super User Tom
Super User

How do you expect SAS (or any computer language) to run a character function like SUBSTR() on a numeric variable like BIGINT value?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

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