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-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!

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.

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
  • 6 replies
  • 2379 views
  • 3 likes
  • 3 in conversation