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

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.

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
  • 2 replies
  • 462 views
  • 0 likes
  • 2 in conversation