BookmarkSubscribeRSS Feed
SAS_newbie1
Calcite | Level 5

Hi

I'm new to SAS and am using SAS Enterprise Guide 4.3.  I have a project that produces several outputs based on dates between first of the month and last of the month for the previous month.  This will eventually be changed to first of the quarter and last of the quarter. All queries come from one user defined table with text, date and number columns.  The outputs are tables of raw data and counts of the data by specific key words.

I have hard coded the dates to get the project running, and now I need to change the dates to variables.  I'm finding SAS dates quite confusing and am not sure how to write this - I think somehow via computed columns?  Can anyone help?  I want this to run automatically and without user interaction on the first day of the month to pull information for the previous month.  This will later be changed to the first day of the quarter to pull information from the previous quarter.

thanks

1 REPLY 1
ChrisHemedinger
Community Manager

This question is marked "Assumed Answered".  Is it?  Did you get what you needed?

You can calculate relative dates with a collection of SAS functions: DATE, TODAY, MDY, INTCK, and more.  You can also use SAS formats to help "bucket" your data for easy aggregation.  The specific solution for you depends on your data and exact query, but I'm sure if you post more details others will offer suggestions.

More reading:

Do you mind if we dance with your DATEs (or DATETIMEs)? - The SAS Dummy

Chris

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

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
  • 1 reply
  • 2660 views
  • 0 likes
  • 2 in conversation