BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sasphd
Lapis Lazuli | Level 10

I am working on a research project and have trouble come up with a way to conduct a rolling window regression. In my proc model I include this macro to do my rolling window.

%do fen = %eval(&dfen) %to 100;

where %eval(&fen) le obs le %eval(36+&fen-1);

However, my proc model is done by id and as you can see in this macro I suppose that the number of observations is 100 for each id but this is not true I have a different number of observation for each id. In my database I add a column which indicates the number of total number of observation for each id (nb).

How can I change the fixed number 100 to a changing variables called nb?

I try to do it like this :

%do fen = %eval(&dfen) %to %eval(&nb);

where %eval(&fen) le obs le %eval(36+&fen-1);

but I have this error

ARNING: Apparent symbolic reference NB not resolved.

ERROR: The text expression &NB contains a recursive reference to the macro variable NB.  The

       macro variable will be assigned the null value.

1 ACCEPTED SOLUTION

Accepted Solutions
2 REPLIES 2
art297
Opal | Level 21

see my response at:

UPRETIGOPI
Obsidian | Level 7

I was also looking for the solution to the similar error but I did not find your solution when I clicked your link

 

Chandra

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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