BookmarkSubscribeRSS Feed
Jyuen204
Obsidian | Level 7

So I am working with a departed developers script. The script used YYYYMM to format field names so the resulting table contains fields that are like 202301, 202302, 202303 ....

I needed to create some additional aggregations off of this particular table but I cannot query a select on these fields due to the way it is set up.
Is there a way I can select these columns by their placing in the table?

2 REPLIES 2
ballardw
Super User

Is your table actually as SAS data set? Those are not normally acceptable variable names for such. If the SAS option VALIDVARNAME=ANY is in effect then such names would have to be referenced in code as "202301"n, quotes around the column heading with the n to tell SAS to treat them a literal names.

 

BTW, this process has placed important information into the "heading" which may mean that many analysis and reporting tasks will be much harder with this data than it should.

Jyuen204
Obsidian | Level 7
Yeah that's the only way i could select it. I was just hoping for an easier way around it.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 519 views
  • 0 likes
  • 2 in conversation