BookmarkSubscribeRSS Feed
omega1983
Calcite | Level 5

data _null_;

BPM = INTNX('Month',&pbd_date,-1,'b');/*1st day LM*/

EPM = INTNX('Month',&pbd_date,-1,'e');/*Last day last Month*/

CALL SYMPUT('pmb',BPM);

CALL SYMPUT('pme',EPM);

run;

%put &pmb &pme

I want to assign a variable name called LastMth to encompass a range between BPM and EPM (or all of last month).  I want to be able to use this in a datastep to capture records that fall within the entire month(last month).

For example something like LastMth = range between &pmb and &pme ??

then I want to use it in a datastep like this

data want_&LastMth

set something;

run;

3 REPLIES 3
Mit
Calcite | Level 5 Mit
Calcite | Level 5

could you please give us some sample data and expected output data?

art297
Opal | Level 21

i'm NOT suggesting this is the best way to accomplish what you want, but are your data and problem similar to the one described at: https://communities.sas.com/message/185021#185021

Reeza
Super User

If you want monthly data try yearmon7.  or yymm6. format for your dates which will group all data into months instead of days.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 806 views
  • 0 likes
  • 4 in conversation