## Help summing variables on the basis of their names

Solved
Occasional Contributor
Posts: 5

# Help summing variables on the basis of their names

Dear community

I've created a lot of numeric variables with the following naming convention: TIME[WEEK][WEEKDAY][HOUR][STATUS]

[week] has 2 digits, [weekday] 1 digit, [hour] 2 digits, [status] 1 digit (1/2 dummy).

Ex: August 13 10 AM would be named: TIME334102 ( I use European calendar and week calculations).

In the variables I've stored minute values ranging from 0 to 60.

I would for instance like to sum all TIME variables with [weekday]=4.

Can this be done?

I know the   array num_vars

• _NUMERIC_; function and the OF operator, but I'm missing some pieces in the puzzle.
• Any help is appreciated.

Thank you.

Accepted Solutions
Solution
‎08-13-2015 12:14 PM
Super User
Posts: 13,889

## Re: Help summing variables on the basis of their names

Some example of what your data actually looks like would be helpful.

Depending on what your project started with you might have been better off with single variable for date/time and another for what ever you want to sum. If all of your summary activities are going to work around ideas like week of year, day of week then a date variable might suffice.

If you have a date variable then you can inspect that easily with functions such as Year, Month, Day and such and often summarize with other procedures by assigning a format to the date variable to create groups.

All Replies
Solution
‎08-13-2015 12:14 PM
Super User
Posts: 13,889

## Re: Help summing variables on the basis of their names

Some example of what your data actually looks like would be helpful.

Depending on what your project started with you might have been better off with single variable for date/time and another for what ever you want to sum. If all of your summary activities are going to work around ideas like week of year, day of week then a date variable might suffice.

If you have a date variable then you can inspect that easily with functions such as Year, Month, Day and such and often summarize with other procedures by assigning a format to the date variable to create groups.

Occasional Contributor
Posts: 5

## Re: Help summing variables on the basis of their names

Hi

I actually solved my problem right after posting it.

Seems that just to formulate the problem helped me solve it.

Thank you anyway.

🔒 This topic is solved and locked.