DATA Step, Macro, Functions and more

SAS create a paremeter from a user define parameter

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 97
Accepted Solution

SAS create a paremeter from a user define parameter

Hello

Let's say that a user define  a parameter

%let mon=1804;

(meaning April 2018)

 

I want that SAS will create automatically a new parameter called tar that get value  '30APR2017'd (end of month after deduct 12 months from mon parameter)

How can I do it?

 

 

Thanks

Ronein


Accepted Solutions
Solution
a week ago
Super Contributor
Posts: 368

Re: SAS create a paremeter from a user define parameter

%let mon = 1804;

data out;
 format tar yymmdd10.;
 tar = intnx('month',input("&mon",yymmn4.),-12,'end');
run;

Smiley Happy

 

//Fredrik

View solution in original post


All Replies
Solution
a week ago
Super Contributor
Posts: 368

Re: SAS create a paremeter from a user define parameter

%let mon = 1804;

data out;
 format tar yymmdd10.;
 tar = intnx('month',input("&mon",yymmn4.),-12,'end');
run;

Smiley Happy

 

//Fredrik

Super User
Super User
Posts: 9,416

Re: SAS create a paremeter from a user define parameter

The question is why you need two macro variables for this.  You have stated you have one macro variable with a timepoint, and you know the logic to get end of month date from that, so why store that second one in a macro variable, just apply the logic where you need it.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 111 views
  • 1 like
  • 3 in conversation