Desktop productivity for business analysts and programmers

Date variables via computed columns

Reply
Occasional Contributor
Posts: 6

Date variables via computed columns

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

Community Manager
Posts: 2,697

Re: Date variables via computed columns

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

Ask a Question
Discussion stats
  • 1 reply
  • 643 views
  • 0 likes
  • 2 in conversation