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

ok i know its odd, but i have a field name:

 

D.DISPUTE_ID||'0'||R.REASON_NUMB

 

how do I deal with that in a PROC SQL column name?

 

thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@StaticFX wrote:

ok i know its odd, but i have a field name:

 

D.DISPUTE_ID||'0'||R.REASON_NUMB

 

how do I deal with that in a PROC SQL column name?

 

thanks!


Beat up whoever created it.

 

It looks like someone attempted to concatenate some values to create a variable but did it incorrectly, possibly in a macro

If that is the actual name you should be able to reference it using the name literal syntax: "D.DISPUTE_ID||'0'||R.REASON_NUMB"n

 

I would be very tempted to rename the variable (and fix any process assigning such a name) as typing such a name is asking for syntax errors.

View solution in original post

6 REPLIES 6
collinelliot
Barite | Level 11

I don't know what you mean by this. That looks like the code is concatenating dispute_id from one table (alias d) and reason_numb from another (alias r) with a "0" in the middle. If this is just part of a select statement, I don't know what needs to change (other than possible issues with leading blanks). If it's part of a create table, you'd just want to do "D.DISPUTE_ID||'0'||R.REASON_NUMB AS your_desired_name," for the syntax. 

StaticFX
Obsidian | Level 7

thats what it is doing in the original query...

 

but thats the actual column name now lol..I am afraid to rename the field in the original SQL code that creates the table because the table is used by who knows how many other scripts...

 

I would rename it myself but I cant get it to accept it lol

 

SELECT ID, [D.DISPUTE_ID||'0'||R.REASON_NUMB], INVOICE_DATE FROM COMBINED;

SELECT ID, "D.DISPUTE_ID||'0'||R.REASON_NUMB", INVOICE_DATE FROM COMBINED;

SELECT ID, `D.DISPUTE_ID||'0'||R.REASON_NUMB`, INVOICE_DATE FROM COMBINED;

 

nothing works..

 

 

ballardw
Super User

@StaticFX wrote:

ok i know its odd, but i have a field name:

 

D.DISPUTE_ID||'0'||R.REASON_NUMB

 

how do I deal with that in a PROC SQL column name?

 

thanks!


Beat up whoever created it.

 

It looks like someone attempted to concatenate some values to create a variable but did it incorrectly, possibly in a macro

If that is the actual name you should be able to reference it using the name literal syntax: "D.DISPUTE_ID||'0'||R.REASON_NUMB"n

 

I would be very tempted to rename the variable (and fix any process assigning such a name) as typing such a name is asking for syntax errors.

collinelliot
Barite | Level 11

I concur with this: "Beat up whoever created it." 

 

 

StaticFX
Obsidian | Level 7

ahhh i dint see the n after thank you! that was driving me nuts!! 🙂 I am renaming it from the query too lol

 

 

PS: im looking for the person who started it! lol

ballardw
Super User

@StaticFX wrote:

ahhh i dint see the n after thank you! that was driving me nuts!! 🙂 I am renaming it from the query too lol

 

 

PS: im looking for the person who started it! lol


 

Start with the person in your shop refers to "macros" the most.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 3489 views
  • 3 likes
  • 3 in conversation