BookmarkSubscribeRSS Feed
sass_numero_uno
Fluorite | Level 6

Using a prompt, which takes a single integer numeric value, eg 4. How can I use this prompt to create a dynamic column name.

 

I use the prompt value to bring through certain columns, called something like "Names".

 

I would like to be able to name the columns something like "Names_Year_X".

 

Where X is the prompt value.

 

I have tried referring to the prompt value by using methods such as "Names_Year_&Prompt" and "Names_Year_&&Prompt&Prompt". 

 

However, none of the above methods work, nor do a number of others I've tried. Does anyone have any advice for house this might work? Preferably using the Query Builder, but if not using a program node for some code is a secondary back up option. 

4 REPLIES 4
tomrvincent
Rhodochrosite | Level 12
Have you tried adding a computed column with the name Names_Year_&Prompt?
sass_numero_uno
Fluorite | Level 6
Yes. I have attempted this, and it just appears as what a literally type, so in this instance, "Names_Year_&Prompt"
andreas_lds
Jade | Level 19

Please post the full code you used to create the dynamically named column.

tomrvincent
Rhodochrosite | Level 12
Take the code from your query builder and put it into a new program, then just change the single quotes to double quotes.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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