BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Boka98
Calcite | Level 5

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.

    1 ACCEPTED SOLUTION

    Accepted Solutions
    ballardw
    Super User

    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.

    View solution in original post

    2 REPLIES 2
    ballardw
    Super User

    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.

    Boka98
    Calcite | Level 5

    Hi

    I actually solved my problem right after posting it.

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

    Thank you anyway.

    hackathon24-white-horiz.png

    The 2025 SAS Hackathon has begun!

    It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

    Latest Updates

    Creating Custom Steps in SAS Studio

    Check out this tutorial series to learn how to build your own steps in SAS Studio.

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