BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

I want to create a macro variable called vector .

Condition 1:

If data set transtbl doesn't exist then  vector will get value of 2009+2010+.....+....+current month

(For example: ?If current month is July 2021 then the macro variable will get value  2009+2010+2011+2012+2101+2102+2103+2104+2105+2106+2107)

Condition 2:

If data set  transtbl exists then vector will get value of  : 

one month after min month in data set transtbl +.....................+  current month

(so for example if min month of field date in data set transtbl is 02Mar2021  and current month is July 2021 then vector will get value  2103+2104+2105+2106+2107 

 

Data transtbl ;
Format date date9.;
Input Id date : date9. amount;
cards;
1 18MAY2021 100
2 21FEB2021 200
3 08FEB2021 300
4 11MAR2021 100
5 27FEB2021 400
6 02FEB2021 800
7 20JUN2021 900
8 29MAY2021 100
9 17FEB2021 200
10 15FEB2021 300
;
Run;
1 REPLY 1
Tom
Super User Tom
Super User

So what did you try?  How did it not work?

 

You seem to have left out a key piece of information.  What is the meaning of those four digit strings between the plus signs?

Are we supposed to guess what they mean?

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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