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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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